9#ifndef INCLUDED_BSLMT_THROUGHPUTBENCHMARK
10#define INCLUDED_BSLMT_THROUGHPUTBENCHMARK
154#include <bslscm_version.h>
168#include <bsl_functional.h>
169#include <bsl_vector.h>
174class ThroughputBenchmark_TestUtil;
294 bool isRunState()
const;
371 int millisecondsPerSample,
374 int millisecondsPerSample,
528bool ThroughputBenchmark::isRunState()
const
537 if (0 == d_threadGroups.size()) {
541 int numThreads = d_threadGroups[0].d_numThreads;
551 return static_cast<int>(d_threadGroups.size());
560 return d_threadGroups[threadGroupIndex].d_numThreads;
568 return d_threadGroups.get_allocator().mechanism();
599 return d_data.d_state;
606 return d_data.d_threadGroups;
Forward declaration.
Definition bslstl_function.h:946
Definition bslstl_vector.h:1120
Definition bslma_allocator.h:545
Definition bslmt_barrier.h:353
Definition bslmt_throughputbenchmarkresult.h:140
Definition bslmt_throughputbenchmark.h:492
~ThroughputBenchmark_TestUtil()=default
Destroy this object.
ThroughputBenchmark_TestUtil(ThroughputBenchmark &data)
Definition bslmt_throughputbenchmark.h:589
bsl::vector< ThroughputBenchmark::ThreadGroup > & threadGroups()
Definition bslmt_throughputbenchmark.h:604
bsls::AtomicInt & state()
Definition bslmt_throughputbenchmark.h:597
Definition bslmt_throughputbenchmark.h:461
void operator()()
Work function being run on the thread.
ThroughputBenchmark_WorkFunction(ThroughputBenchmark_WorkData &data)
Definition bslmt_throughputbenchmark.h:577
~ThroughputBenchmark_WorkFunction()=default
Destroy this object.
Definition bslmt_throughputbenchmark.h:189
bsl::function< void(bool)> ShutdownSampleFunction
Definition bslmt_throughputbenchmark.h:221
void execute(ThroughputBenchmarkResult *result, int millisecondsPerSample, int numSamples)
bsl::function< void()> InitializeThreadFunction
Definition bslmt_throughputbenchmark.h:236
bsl::function< void(bool)> CleanupSampleFunction
Definition bslmt_throughputbenchmark.h:229
int numThreadsInGroup(int threadGroupIndex) const
Definition bslmt_throughputbenchmark.h:555
int numThreadGroups() const
Return the number of thread groups.
Definition bslmt_throughputbenchmark.h:549
bsl::function< void()> CleanupThreadFunction
Definition bslmt_throughputbenchmark.h:243
bsl::function< void(bool)> InitializeSampleFunction
Definition bslmt_throughputbenchmark.h:212
static unsigned int antiOptimization()
ThroughputBenchmark(bslma::Allocator *basicAllocator=0)
void execute(ThroughputBenchmarkResult *result, int millisecondsPerSample, int numSamples, const InitializeSampleFunction &initializeFunctor, const ShutdownSampleFunction &shutdownFunctor, const CleanupSampleFunction &cleanupFunctor)
static bsls::Types::Int64 estimateBusyWorkAmount(bsls::TimeInterval duration)
BSLMF_NESTED_TRAIT_DECLARATION(ThroughputBenchmark, bslma::UsesBslmaAllocator)
int addThreadGroup(const RunFunction &runFunction, int numThreads, bsls::Types::Int64 busyWorkAmount, const InitializeThreadFunction &initializeFunctor, const CleanupThreadFunction &cleanupFunctor)
bslma::Allocator * allocator() const
Return the allocator used by this object.
Definition bslmt_throughputbenchmark.h:566
int addThreadGroup(const RunFunction &runFunction, int numThreads, bsls::Types::Int64 busyWorkAmount)
bsl::function< void(int)> RunFunction
Definition bslmt_throughputbenchmark.h:204
int numThreads() const
Return the total number of threads.
Definition bslmt_throughputbenchmark.h:535
static void busyWork(bsls::Types::Int64 busyWorkAmount)
Definition bsls_atomic.h:744
int loadAcquire() const
Definition bsls_atomic.h:1753
Definition bsls_atomic.h:1050
Definition bsls_timeinterval.h:307
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslmt_barrier.h:344
Definition bslma_usesbslmaallocator.h:344
Definition bslmt_throughputbenchmark.h:248
InitializeThreadFunction d_initialize
Definition bslmt_throughputbenchmark.h:260
CleanupThreadFunction d_cleanup
Definition bslmt_throughputbenchmark.h:263
int d_numThreads
Definition bslmt_throughputbenchmark.h:253
RunFunction d_func
Definition bslmt_throughputbenchmark.h:251
bsls::Types::Int64 d_amount
Definition bslmt_throughputbenchmark.h:256
Definition bslmt_throughputbenchmark.h:408
ThroughputBenchmark::InitializeThreadFunction d_initialize
Definition bslmt_throughputbenchmark.h:417
bsls::Types::Int64 d_amount
Definition bslmt_throughputbenchmark.h:414
bslmt::Barrier * d_barrier_p
Definition bslmt_throughputbenchmark.h:437
bsls::Types::Int64 d_actualNanos
Definition bslmt_throughputbenchmark.h:443
int d_threadIndex
Definition bslmt_throughputbenchmark.h:430
ThroughputBenchmark::CleanupThreadFunction d_cleanup
Definition bslmt_throughputbenchmark.h:421
ThroughputBenchmark * d_bench_p
Definition bslmt_throughputbenchmark.h:425
bsls::Types::Int64 d_count
Definition bslmt_throughputbenchmark.h:448
ThroughputBenchmark::RunFunction d_func
Definition bslmt_throughputbenchmark.h:411
long long Int64
Definition bsls_types.h:134