#include <rw/rwtest/perf/RWQEPerfTest.h>
|
| StopWorkFunction (std::mutex &mutex, uint64_t &maxIterations, uint64_t maxTime) |
|
bool | operator() (uint64_t totalRunTime, uint64_t iteration) |
|
StopWorkFunction implements a check to determine if a work thread has reached it's termination point. This can be accomplished by either running until the maximum number of iterations defined is reached or the maximum runtime has been reached.
StopWorkFunction::StopWorkFunction |
( |
std::mutex & |
mutex, |
|
|
uint64_t & |
maxIterations, |
|
|
uint64_t |
maxTime |
|
) |
| |
|
inline |
Constructor
- Parameters
-
mutex | A shared mutex that guards access to the lastIteration |
maxIterations | A shared variable to keep track across threads when a thread has reached a termination point. This value is used to indicate to other threads that they should run no more when they reach that value. |
maxTime | The maximum time (in milliseconds) the test should execute. |
bool StopWorkFunction::operator() |
( |
uint64_t |
totalRunTime, |
|
|
uint64_t |
iteration |
|
) |
| |
|
inline |
Returns true
when work should stop:
- If the maximum number of iterations has been executed.
- If the maximum runtime has been reached, the current iteration will complete, and the function will return true for the next iteration.
- Parameters
-
totalRunTime | Total time spent executing so far. |
iteration | Current iteration number being executed. |