mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-20 06:52:03 +00:00
examples: allow a desianted main thread capacity.
Maximum threads is not always peak the highest performance, tvg examples guide user the proper threads count.
This commit is contained in:
parent
aa68481fb7
commit
19fc4f4b37
33 changed files with 33 additions and 0 deletions
|
@ -176,6 +176,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -172,6 +172,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -175,6 +175,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -155,6 +155,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -144,6 +144,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -235,6 +235,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -201,6 +201,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -174,6 +174,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -222,6 +222,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -138,6 +138,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -208,6 +208,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -229,6 +229,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -195,6 +195,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -173,6 +173,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -195,6 +195,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -215,6 +215,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -133,6 +133,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -189,6 +189,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -150,6 +150,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -187,6 +187,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -154,6 +154,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -173,6 +173,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -180,6 +180,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -225,6 +225,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -123,6 +123,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -190,6 +190,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -202,6 +202,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -181,6 +181,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -255,6 +255,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -163,6 +163,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -130,6 +130,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -192,6 +192,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
|
@ -153,6 +153,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
//Threads Count
|
//Threads Count
|
||||||
auto threads = std::thread::hardware_concurrency();
|
auto threads = std::thread::hardware_concurrency();
|
||||||
|
if (threads > 0) --threads; //Allow the designated main thread capacity
|
||||||
|
|
||||||
//Initialize ThorVG Engine
|
//Initialize ThorVG Engine
|
||||||
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue