BloombergLP::bslmt::ThroughputBenchmark::addThreadGroup

Create a set of threads that repeatedly execute a test function with per-thread initialize and cleanup hooks.

Synopsis

Declared in <bslmt_throughputbenchmark.h>

int
addThreadGroup(
    RunFunction const& runFunction,
    int numThreads,
    bsls::Types::Int64 busyWorkAmount,
    InitializeThreadFunction const& initializeFunctor,
    CleanupThreadFunction const& cleanupFunctor);

Description

Create a set of threads, with cardinality the specified numThreads, that will repeatedly execute the specified runFunction followed by the specified busyWork, with the specified busyWorkAmount as its argument. Return the index for the thread group. Specify initializeFunctor, which is run at the beginning of each thread of the sample. Specify cleanupFunctor, which is run at the end of each thread of the sample. The behavior is undefined unless 0 < numThreads and 0 <= busyWorkAmount.

Return Value

index of the created thread group

Parameters

NameDescription
runFunctionfunction each thread repeatedly executes
numThreadsnumber of threads in the group
busyWorkAmountwork amount passed to busyWork between calls
initializeFunctorfunctor run at the start of each thread
cleanupFunctorfunctor run at the end of each thread