Created
July 22, 2020 01:28
-
-
Save yushulx/f8c85554ed7c24204185679a97318305 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const auto processor_count = std::thread::hardware_concurrency(); | |
int minimum_count = 1, minimum_timecost = 0; | |
for (int i = 0; i < processor_count; i++) | |
{ | |
printf("Thread count: %d. ", i + 1); | |
int timecost = barcode_decoding(buffer, size, formats, i, license, config); | |
if (i == 0) | |
{ | |
minimum_count = 1; | |
if (timecost > 0) | |
{ | |
minimum_timecost = timecost; | |
} | |
} | |
else { | |
if (timecost < minimum_timecost) | |
{ | |
minimum_count = i + 1; | |
minimum_timecost = timecost; | |
} | |
} | |
} | |
printf("Multi-thread best performance: thread_count = %d, timecost = %d \n\n", minimum_count, minimum_timecost); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment