Run previously added thread groups with sample‐level hooks.
Synopsis
Declared in <bslmt_throughputbenchmark.h>
void
execute(
ThroughputBenchmarkResult* result,
int millisecondsPerSample,
int numSamples,
InitializeSampleFunction const& initializeFunctor,
ShutdownSampleFunction const& shutdownFunctor,
CleanupSampleFunction const& cleanupFunctor);
Description
Run the tests previously added with calls to the addThreadGroup method. The tests are run for the specified numSamples times. Each sample is run for the specified millisecondsPerSample duration. The results are stored in the specified result object. Specify initializeFunctor, which is run at the beginning of the sample and accepts a boolean flag isFirst, that is set to true on the first sample, and false otherwise. Specify shutdownFunctor, which is run at the end of each sample before threads have been joined, and accepts a boolean flag isLast, that is set to true on the last sample, and false otherwise. Specify cleanupFunctor, which is run at the end of each sample after threads have been joined, and accepts a boolean flag isLast, that is set to true on the last sample, and false otherwise. The behavior is undefined unless 0 < millisecondsPerSample, 0 < numSamples, and 0 < numThreadGroups(). Also see []of a Test).
Parameters
Name |
Description |
result |
repository that receives the sample throughputs |
millisecondsPerSample |
duration of each sample in milliseconds |
numSamples |
number of times the test is executed |
initializeFunctor |
functor run at the start of each sample |
shutdownFunctor |
functor run before joining sample threads |
cleanupFunctor |
functor run after joining sample threads |
Created with MrDocs