Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions | Friends

bslmt::ThroughputBenchmarkResult Class Reference

#include <bslmt_throughputbenchmarkresult.h>

List of all members.

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)
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
int numThreadGroups () const
int numThreads (int threadGroupIndex) const
int totalNumThreads () const
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

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 Component bslmt_throughputbenchmarkresult


Member Typedef Documentation


Constructor & Destructor Documentation

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.

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.

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.

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.

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).


Member Function Documentation

bslmt::ThroughputBenchmarkResult::BSLMF_NESTED_TRAIT_DECLARATION ( ThroughputBenchmarkResult  ,
bslma::UsesBslmaAllocator   
)
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.

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).

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.

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

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().

int bslmt::ThroughputBenchmarkResult::numSamples (  )  const

Return the number of test samples.

int bslmt::ThroughputBenchmarkResult::numThreadGroups (  )  const

Return the number of thread groups.

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

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

int bslmt::ThroughputBenchmarkResult::totalNumThreads (  )  const

Return the total number of threads.

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

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().

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.

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.

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().

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.

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

Return the allocator used by this object.


Friends And Related Function Documentation

friend class ThroughputBenchmarkResult_TestUtil [friend]

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