SourcePro® C++ API Reference Guide

Product Documentation:
   SourcePro C++
Documentation Home
List of all members | Public Member Functions
StopWorkFunction Struct Reference

#include <rw/rwtest/perf/RWQEPerfTest.h>

Public Member Functions

 StopWorkFunction (std::mutex &mutex, uint64_t &maxIterations, uint64_t maxTime)
 
bool operator() (uint64_t totalRunTime, uint64_t iteration)
 

Detailed Description

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.

Constructor & Destructor Documentation

StopWorkFunction::StopWorkFunction ( std::mutex &  mutex,
uint64_t &  maxIterations,
uint64_t  maxTime 
)
inline

Constructor

Parameters
mutexA shared mutex that guards access to the lastIteration
maxIterationsA 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.
maxTimeThe maximum time (in milliseconds) the test should execute.

Member Function Documentation

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
totalRunTimeTotal time spent executing so far.
iterationCurrent iteration number being executed.

Copyright © 2016 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.