BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmt::ThroughputBenchmarkResult Class Reference

#include <bslmt_throughputbenchmarkresult.h>

Public Types

typedef bsls::Types::Int64 Int64
 
typedef bsl::vector< double > DoubleVector
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (ThroughputBenchmarkResult, bslma::UsesBslmaAllocator)
 
 ThroughputBenchmarkResult (bslma::Allocator *basicAllocator=0)
 
 ThroughputBenchmarkResult (int numSamples, const bsl::vector< int > &threadGroupSizes, bslma::Allocator *basicAllocator=0)
 
 ThroughputBenchmarkResult (const ThroughputBenchmarkResult &original, bslma::Allocator *basicAllocator=0)
 
 ThroughputBenchmarkResult (bslmf::MovableRef< ThroughputBenchmarkResult > original) BSLS_KEYWORD_NOEXCEPT
 
 ThroughputBenchmarkResult (bslmf::MovableRef< ThroughputBenchmarkResult > original, bslma::Allocator *basicAllocator)
 
 ~ThroughputBenchmarkResult ()=default
 Destroy this object.
 
ThroughputBenchmarkResultoperator= (const ThroughputBenchmarkResult &rhs)
 
ThroughputBenchmarkResultoperator= (bslmf::MovableRef< ThroughputBenchmarkResult > rhs)
 
void initialize (int numSamples, const bsl::vector< int > &threadGroupSizes)
 
void setThroughput (int threadGroupIndex, int threadIndex, int sampleIndex, double value)
 
int numSamples () const
 Return the number of test samples.
 
int numThreadGroups () const
 Return the number of thread groups.
 
int numThreads (int threadGroupIndex) const
 
int totalNumThreads () const
 Return the total number of threads.
 
double getValue (int threadGroupIndex, int threadIndex, int sampleIndex) const
 
void getMedian (double *median, int threadGroupIndex) const
 
void getPercentile (double *percentile, double percentage, int threadGroupIndex) const
 
void getPercentiles (bsl::vector< double > *percentiles, int threadGroupIndex) const
 
void getThreadPercentiles (bsl::vector< bsl::vector< double > > *percentiles, int threadGroupIndex) const
 
bslma::Allocatorallocator () const
 Return the allocator used by this object.
 

Friends

class ThroughputBenchmarkResult_TestUtil
 

Detailed Description

This class provides support for output of multi-threaded performance benchmark results. The results are counts of work done during the benchmark time period divided by the time period.

See bslmt_throughputbenchmarkresult

Member Typedef Documentation

◆ DoubleVector

◆ Int64

Constructor & Destructor Documentation

◆ ThroughputBenchmarkResult() [1/5]

bslmt::ThroughputBenchmarkResult::ThroughputBenchmarkResult ( bslma::Allocator basicAllocator = 0)
explicit

Create an empty ThroughputBenchmarkResult object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note that this object has to be initialized before it can be used.

◆ ThroughputBenchmarkResult() [2/5]

bslmt::ThroughputBenchmarkResult::ThroughputBenchmarkResult ( int  numSamples,
const bsl::vector< int > &  threadGroupSizes,
bslma::Allocator basicAllocator = 0 
)

Create a ThroughputBenchmarkResult object with the specified numSamples the number of samples in the benchmark, and the specified threadGroupSizes, the number of threads in each of the thread groups. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless 0 < numSamples, 0 < threadGroupSizes.size(), and 0 < threadGroupSizes[N] for all valid N.

◆ ThroughputBenchmarkResult() [3/5]

bslmt::ThroughputBenchmarkResult::ThroughputBenchmarkResult ( const ThroughputBenchmarkResult original,
bslma::Allocator basicAllocator = 0 
)

Create a ThroughputBenchmarkResult object having the value of the specified original. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ ThroughputBenchmarkResult() [4/5]

bslmt::ThroughputBenchmarkResult::ThroughputBenchmarkResult ( bslmf::MovableRef< ThroughputBenchmarkResult original)

Create a ThroughputBenchmarkResult object having the same value and the same allocator as the specified original object. The value of original becomes unspecified but valid, and its allocator remains unchanged.

◆ ThroughputBenchmarkResult() [5/5]

bslmt::ThroughputBenchmarkResult::ThroughputBenchmarkResult ( bslmf::MovableRef< ThroughputBenchmarkResult original,
bslma::Allocator basicAllocator 
)

Create a ThroughputBenchmarkResult object having the same value as the specified original object, using the specified basicAllocator to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The allocator of original remains unchanged. If original and the newly created object have the same allocator then the value of original becomes unspecified but valid, and no exceptions will be thrown; otherwise original is unchanged (and an exception may be thrown).

◆ ~ThroughputBenchmarkResult()

bslmt::ThroughputBenchmarkResult::~ThroughputBenchmarkResult ( )
default

Member Function Documentation

◆ allocator()

bslma::Allocator * bslmt::ThroughputBenchmarkResult::allocator ( ) const
inline

◆ BSLMF_NESTED_TRAIT_DECLARATION()

bslmt::ThroughputBenchmarkResult::BSLMF_NESTED_TRAIT_DECLARATION ( ThroughputBenchmarkResult  ,
bslma::UsesBslmaAllocator   
)

◆ getMedian()

void bslmt::ThroughputBenchmarkResult::getMedian ( double *  median,
int  threadGroupIndex 
) const

Load into the specified median the median throughput (count / second) of the work done by all the threads in the specified threadGroupIndex. The behavior is undefined unless 0 <= threadGroupIndex < numThreadGroups.

◆ getPercentile()

void bslmt::ThroughputBenchmarkResult::getPercentile ( double *  percentile,
double  percentage,
int  threadGroupIndex 
) const

Load into the specified percentile the specified percentage throughput (count / second) of the work done by all the threads in the specified threadGroupIndex. A percentage of 0.0 is the minimum, and a percentage of 1.0 is the maximum. The behavior is undefined unless 0 <= threadGroupIndex < numThreadGroups and 0.0 <= percentage <= 1.0.

◆ getPercentiles()

void bslmt::ThroughputBenchmarkResult::getPercentiles ( bsl::vector< double > *  percentiles,
int  threadGroupIndex 
) const

Load into the specified percentiles vector a uniform breakdown of percentage throughput (count / second) of the work done by all the threads in the specified threadGroupIndex. The size of percentiles controls how many percentages are provided. For example, a size of 5 will return the percentages 0, 0.25, 0.5, 0.75,

  1. The behavior is undefined unless 0 <= threadGroupIndex < numThreadGroups and 2 <= percentiles->size().

◆ getThreadPercentiles()

void bslmt::ThroughputBenchmarkResult::getThreadPercentiles ( bsl::vector< bsl::vector< double > > *  percentiles,
int  threadGroupIndex 
) const

Load into the specified percentiles vector of vectors a uniform breakdown of percentage throughput (count / second) of the work done on the specified threadGroupIndex for each of the threads in it. The size of percentiles controls how many percentages are provided. For example, a size of 5 will return the percentages 0, 0.25, 0.5, 0.75, 1. The size of each of the vectors inside stats must be numThreads(threadGroupId). The behavior is undefined unless 0 <= threadGroupId < numThreadGroups, 2 <= percentiles.size(), and percentiles[N].size() == numThreads(threadGroupIndex) for all N.

◆ getValue()

double bslmt::ThroughputBenchmarkResult::getValue ( int  threadGroupIndex,
int  threadIndex,
int  sampleIndex 
) const
inline

Return the throughput of work done on the specified threadIndex thread, in the specified threadGroupIndex, and the specified sampleIndex sample. The behavior is undefined unless 0 <= threadIndex < numThreads(threadGroupIndex), 0 <= threadGroupIndex < numThreadGroups(), and 0 <= sampleIndex < numSamples().

◆ initialize()

void bslmt::ThroughputBenchmarkResult::initialize ( int  numSamples,
const bsl::vector< int > &  threadGroupSizes 
)

Initialize a default constructed ThroughputBenchmarkResult object with the specified numSamples number of samples in the benchmark, and the specified threadGroupSizes, the number of threads in each of the thread groups. If any data was previously kept, it is lost. The behavior is undefined unless 0 < numSamples, 0 < threadGroupSizes.size(), and 0 < threadGroupSizes[N] for all valid N.

◆ numSamples()

int bslmt::ThroughputBenchmarkResult::numSamples ( ) const
inline

◆ numThreadGroups()

int bslmt::ThroughputBenchmarkResult::numThreadGroups ( ) const
inline

◆ numThreads()

int bslmt::ThroughputBenchmarkResult::numThreads ( int  threadGroupIndex) const
inline

Return the number of threads in the specified threadGroupIdx. The behavior is undefined unless 0 <= threadGroupIndex < numThreadGroups().

◆ operator=() [1/2]

ThroughputBenchmarkResult & bslmt::ThroughputBenchmarkResult::operator= ( bslmf::MovableRef< ThroughputBenchmarkResult rhs)

Assign to this object the value of the specified rhs object, and return a non-const reference to this object. The allocators of this object and rhs both remain unchanged. If rhs and this object have the same allocator then the value of rhs becomes unspecified but valid, and no exceptions will be thrown; otherwise rhs is unchanged (and an exception may be thrown).

◆ operator=() [2/2]

ThroughputBenchmarkResult & bslmt::ThroughputBenchmarkResult::operator= ( const ThroughputBenchmarkResult rhs)

Assign to this object the value of the specified rhs benchmark result, and return a reference providing modifiable access to this object.

◆ setThroughput()

void bslmt::ThroughputBenchmarkResult::setThroughput ( int  threadGroupIndex,
int  threadIndex,
int  sampleIndex,
double  value 
)
inline

Set the throughput related to the specified threadIndex thread, in the specified threadGroupIndex, and the specified sampleIndex to the specified value. The behavior is undefined unless 0 <= value, 0 <= threadIndex < numThreads(threadGroupIndex), 0 <= threadGroupIndex < numThreadGroups(), and 0 <= sampleIndex < numSamples().

◆ totalNumThreads()

int bslmt::ThroughputBenchmarkResult::totalNumThreads ( ) const
inline

Friends And Related Symbol Documentation

◆ ThroughputBenchmarkResult_TestUtil


The documentation for this class was generated from the following file: