examples: allow a desianted main thread capacity.
authorHermet Park <chuneon.park@samsung.com>
Wed, 24 Mar 2021 05:19:01 +0000 (14:19 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 24 Mar 2021 05:34:37 +0000 (14:34 +0900)
Maximum threads is not always peak the highest performance,
tvg examples guide user the proper threads count.

33 files changed:
src/examples/AnimateMasking.cpp
src/examples/Arc.cpp
src/examples/Async.cpp
src/examples/Blending.cpp
src/examples/Boundary.cpp
src/examples/ClipPath.cpp
src/examples/CustomTransform.cpp
src/examples/DirectUpdate.cpp
src/examples/Duplicate.cpp
src/examples/FillRule.cpp
src/examples/GradientStroke.cpp
src/examples/GradientTransform.cpp
src/examples/InvMasking.cpp
src/examples/LinearGradient.cpp
src/examples/Masking.cpp
src/examples/MultiCanvas.cpp
src/examples/MultiShapes.cpp
src/examples/Opacity.cpp
src/examples/Path.cpp
src/examples/PathCopy.cpp
src/examples/PixelImage.cpp
src/examples/RadialGradient.cpp
src/examples/Scene.cpp
src/examples/SceneTransform.cpp
src/examples/Shape.cpp
src/examples/Stacking.cpp
src/examples/Stress.cpp
src/examples/Stroke.cpp
src/examples/StrokeLine.cpp
src/examples/Svg.cpp
src/examples/Svg2.cpp
src/examples/Transform.cpp
src/examples/Update.cpp

index 0436385..078f915 100644 (file)
@@ -176,6 +176,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 850ffc8..e1bd5e3 100644 (file)
@@ -172,6 +172,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2b067cf..0ddcd22 100644 (file)
@@ -175,6 +175,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 8015e0d..cd4d236 100644 (file)
@@ -155,6 +155,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 88ca7b9..a42cca2 100644 (file)
@@ -144,6 +144,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 57e6234..a780b38 100644 (file)
@@ -235,6 +235,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 9a75e8b..3c6bdee 100644 (file)
@@ -201,6 +201,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index e72d1b6..2ed97bb 100644 (file)
@@ -174,6 +174,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 1c9333d..580e3a0 100644 (file)
@@ -222,6 +222,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index dda6f35..8449fa1 100644 (file)
@@ -138,6 +138,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 87ccb99..60b81ce 100644 (file)
@@ -208,6 +208,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index eb46bf1..345bb7d 100644 (file)
@@ -229,6 +229,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 61ab17a..ad18655 100644 (file)
@@ -195,6 +195,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index fe21631..b3bdc8e 100644 (file)
@@ -173,6 +173,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 968ef72..6140a2b 100644 (file)
@@ -195,6 +195,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 6bdb642..1bd6150 100644 (file)
@@ -215,6 +215,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 9902604..64cc130 100644 (file)
@@ -133,6 +133,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index ff2bf7f..35bfc9c 100644 (file)
@@ -189,6 +189,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index eaf1ddf..535ff9f 100644 (file)
@@ -150,6 +150,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 716ab5e..69281a3 100644 (file)
@@ -187,6 +187,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 72c95dd..e65087a 100644 (file)
@@ -154,6 +154,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 3f8dfde..101e514 100644 (file)
@@ -173,6 +173,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index d4a5db3..4b04772 100644 (file)
@@ -180,6 +180,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2db9de7..8272859 100644 (file)
@@ -225,6 +225,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 23a949a..de6fc4f 100644 (file)
@@ -123,6 +123,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 871b42f..afae969 100644 (file)
@@ -190,6 +190,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 62041c6..862b6af 100644 (file)
@@ -202,6 +202,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 783efbc..4837ace 100644 (file)
@@ -181,6 +181,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index c138ecf..dbc94d6 100644 (file)
@@ -255,6 +255,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 74a3049..33cb982 100644 (file)
@@ -163,6 +163,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index f2fc825..db82369 100644 (file)
@@ -130,6 +130,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 3ab896a..2466c30 100644 (file)
@@ -192,6 +192,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2875066..981e95a 100644 (file)
@@ -153,6 +153,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {