| 46 | } |
| 47 | |
| 48 | void ThreadTestFixture::startThreads(uint64_t threads, uint64_t iterations) |
| 49 | { |
| 50 | const uint64_t iterationsPerThread = iterations / threads; |
| 51 | |
| 52 | for(uint64_t i = 0; i < threads; ++i) |
| 53 | { |
| 54 | try |
| 55 | { |
| 56 | this->pimpl->futures.push_back( |
| 57 | // std::async(std::launch::deferred, |
| 58 | std::async(std::launch::async, [this, i, iterationsPerThread]() { |
| 59 | this->pimpl->currentThreadId = i + 1; |
| 60 | for(auto threadIterationCounter = size_t(0); threadIterationCounter < iterationsPerThread;) |
| 61 | { |
| 62 | this->pimpl->currentCallId = ++threadIterationCounter; |
| 63 | this->UserBenchmark(); |
| 64 | } |
| 65 | })); |
| 66 | } |
| 67 | catch(std::system_error& e) |
| 68 | { |
| 69 | std::cerr << "ERROR: Exception. Error Code: " << e.code() << ", " << e.what() << "\n"; |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void ThreadTestFixture::stopThreads() |
| 75 | { |
no test coverage detected