This class is a mechanism that provides performance testing for multi- threaded components. It allows running different thread functions at the same time, and simulates a work load between subsequent calls to the tested thread functions. The results are loaded into a bslmt::ThroughputBenchmarkResult object, which provides access to counts of the work done by each thread, thread group, and sample, divided by the number of actual seconds of execution.
Declared in <bslmt_throughputbenchmark.h>
class ThroughputBenchmark;
| Name | Description |
|---|---|
ThreadGroup | Data used by a thread group |
| Name | Description |
|---|---|
CleanupSampleFunction | An alias to a function meeting the following contract: ` /// Clean up after the sample run. If the specified isLast is /// true, this is the last sample run. void cleanupSample(bool isLast); ` |
CleanupThreadFunction | An alias to a function meeting the following contract: ` /// Clean up after each thread in a sample run. void cleanupThread(); ` |
InitializeSampleFunction | An alias to a function meeting the following contract: ` /// Initialize the sample run. If the specified isFirst is true, /// this is the first sample run. void initializeSample(bool isFirst); ` |
InitializeThreadFunction | An alias to a function meeting the following contract: ` /// Initialize each thread in a sample run. void initializeThread(); ` |
RunFunction | An alias to a function meeting the following contract: ` /// Run the main part of the benchmark having the specified /// threadIndex. The behavior is undefined unless threadIndex is /// in the range [0, numThreadsInGroup)], where numThreadsInGroup is /// the number of threads in a thread group for the associated /// throughput benchmark. void runTest(int threadIndex); ` |
ShutdownSampleFunction | An alias to a function meeting the following contract: ` /// Clean up at the end of the sample run, before threads have been /// joined. If the specified isLast is true, this is the last /// sample run. void shutdownSample(bool isLast); ` |
| Name | Description |
|---|---|
ThroughputBenchmark [constructor] | Create an empty ThroughputBenchmark object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. |
addThreadGroup | addThreadGroup overloads |
allocator | Return the allocator used by this object. |
execute | execute overloads |
numThreadGroups | Return the number of thread groups. |
numThreads | Return the total number of threads. |
numThreadsInGroup | Return the number of threads in the specified threadGroupIndex. The behavior is undefined unless 0 <= threadGroupIndex < numThreadGroups(). |
operator BloombergLP::bslmf::NestedTraitDeclaration<ThroughputBenchmark, UsesBslmaAllocator> | Declare that this type uses a bslma allocator. |
| Name | Description |
|---|---|
antiOptimization | Return the value calculated by busyWork. Note that this method is provided to prevent the compiler from optimizing the simulated workload away. |
busyWork | Perform arithmetic operations to consume an amount of time in linear relation to the specified busyWorkAmount. Note that the duration of busyWork invoked with a particular busyWorkAmount will vary with system load. |
estimateBusyWorkAmount | Return an estimate of the work amount so that busyWork invoked with the returned work amount executes, approximately, for the specified duration. Note that this estimate varies with system load. |
| Name | Description |
|---|---|
BloombergLP::bslmt::ThroughputBenchmark_TestUtil | This class implements a test utility that gives the test driver access to the unexposed data members of ThroughputBenchmark. |
BloombergLP::bslmt::ThroughputBenchmark_WorkFunction | This class is the work function functor, being called for each work thread. |