[#BloombergLP-bslmt-ThroughputBenchmark-execute-04] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThroughputBenchmark.adoc[ThroughputBenchmark]::execute :relfileprefix: ../../../ :mrdocs: Run previously added thread groups with sample‐level hooks. == Synopsis Declared in `<bslmt_throughputbenchmark.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void execute( xref:BloombergLP/bslmt/ThroughputBenchmarkResult.adoc[ThroughputBenchmarkResult]* result, int millisecondsPerSample, int numSamples, xref:BloombergLP/bslmt/ThroughputBenchmark/InitializeSampleFunction.adoc[InitializeSampleFunction] const& initializeFunctor, xref:BloombergLP/bslmt/ThroughputBenchmark/ShutdownSampleFunction.adoc[ShutdownSampleFunction] const& shutdownFunctor, xref:BloombergLP/bslmt/ThroughputBenchmark/CleanupSampleFunction.adoc[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). [.small]#Created with https://www.mrdocs.com[MrDocs]#