HEBench
hebench::cpp::BenchmarkDescription Class Referenceabstract

Base class for objects representing a specific benchmark based on an HEBench benchmark descriptor. More...

#include <benchmark.hpp>

Inheritance diagram for hebench::cpp::BenchmarkDescription:
Collaboration diagram for hebench::cpp::BenchmarkDescription:

Public Member Functions

 BenchmarkDescription ()=default
 
virtual ~BenchmarkDescription ()=default
 
void getBenchmarkDescriptor (hebench::APIBridge::BenchmarkDescriptor &bench_desc) const
 Retrieves the HEBench benchmark descriptor represented by this BenchmarkDescription object. More...
 
const hebench::APIBridge::BenchmarkDescriptorgetBenchmarkDescriptor () const
 Retrieves the HEBench benchmark descriptor represented by this BenchmarkDescription object. More...
 
const std::vector< std::vector< hebench::APIBridge::WorkloadParam > > & getWorkloadDefaultParameters () const
 Retrieves the sets of default arguments supported by this benchmark's workload. More...
 
virtual std::string getBenchmarkDescription (const hebench::APIBridge::WorkloadParams *p_w_params) const
 Retrieves human-readable description specific to the represented benchmark. More...
 
std::size_t getWorkloadParameterCount () const
 Retrieves the number of flexible parameters for this benchmark's workload. More...
 
virtual BaseBenchmarkcreateBenchmark (BaseEngine &engine, const hebench::APIBridge::WorkloadParams *p_params)=0
 Instantiates the represented benchmark. More...
 
virtual void destroyBenchmark (BaseBenchmark *p_bench)=0
 Destroys and frees resources held by a BaseBenchmark (or derived) object previously created by createBenchmark(). More...
 
std::int64_t classTag () const override
 Retrieves the tag of the class to which this object belongs. More...
 
- Public Member Functions inherited from hebench::cpp::ITaggedObject
 ITaggedObject ()
 
virtual ~ITaggedObject ()
 

Static Public Attributes

static constexpr std::int64_t tag = 0x1000000000000000
 Used to identify this class when returned as a handle to Test Harness. More...
 
- Static Public Attributes inherited from hebench::cpp::ITaggedObject
static constexpr std::int64_t MaskByteSet = 0xFF
 
static constexpr std::int64_t MaskReservedBits = MaskByteSet << 56
 Mask representing all bits reserved by C++ wrapper. More...
 

Protected Member Functions

void addDefaultParameters (const WorkloadParams::Common &default_params_set)
 Adds a new set of default arguments for the parameters for this benchmark's workload. More...
 
void addDefaultParameters (const std::vector< hebench::APIBridge::WorkloadParam > &default_params_set)
 Adds a new set of default arguments for the parameters for this benchmark's workload. More...
 

Protected Attributes

hebench::APIBridge::BenchmarkDescriptor m_descriptor
 HEBench descriptor for this benchmark. More...
 

Detailed Description

Base class for objects representing a specific benchmark based on an HEBench benchmark descriptor.

An HEBench benchmark descriptor describes a unique benchmark and specifies default workload parameters supported.

This class wraps the functionality to describe, instantiate and destroy the appropriate benchmark class. A BaseEngine (or derived class) uses this behavior to create the appropriate benchmark object that can execute the workload requested by Test Harness.

Definition at line 35 of file benchmark.hpp.

Constructor & Destructor Documentation

◆ BenchmarkDescription()

hebench::cpp::BenchmarkDescription::BenchmarkDescription ( )
default

◆ ~BenchmarkDescription()

virtual hebench::cpp::BenchmarkDescription::~BenchmarkDescription ( )
virtualdefault

Member Function Documentation

◆ addDefaultParameters() [1/2]

void hebench::cpp::BenchmarkDescription::addDefaultParameters ( const std::vector< hebench::APIBridge::WorkloadParam > &  default_params_set)
protected

Adds a new set of default arguments for the parameters for this benchmark's workload.

Parameters
[in]default_params_setThe new set of default values for the parameters of this workload.
Exceptions
std::invalid_argumentif size of default_params_set is invalid. See details.

If this is not the first set added, the size of default_params_set must be the same as any other existing default parameter sets.

Definition at line 38 of file benchmark.cpp.

◆ addDefaultParameters() [2/2]

void hebench::cpp::BenchmarkDescription::addDefaultParameters ( const WorkloadParams::Common default_params_set)
protected

Adds a new set of default arguments for the parameters for this benchmark's workload.

Parameters
[in]default_params_setThe new set of default values for the parameters of this workload.
Exceptions
std::invalid_argumentif size of default_params_set is invalid. See details.

If this is not the first set added, default_params_set must represent a set with the same amount of parameters as any other existing default parameter sets.

Definition at line 33 of file benchmark.cpp.

◆ classTag()

std::int64_t hebench::cpp::BenchmarkDescription::classTag ( ) const
inlineoverridevirtual

Retrieves the tag of the class to which this object belongs.

Most significant 8 bits of the 64-bit tag are reserved by C++ wrapper. See ITaggedObject for more details.

Implements hebench::cpp::ITaggedObject.

Definition at line 102 of file benchmark.hpp.

◆ createBenchmark()

virtual BaseBenchmark* hebench::cpp::BenchmarkDescription::createBenchmark ( BaseEngine engine,
const hebench::APIBridge::WorkloadParams p_params 
)
pure virtual

Instantiates the represented benchmark.

Parameters
engineEngine creating the benchmark.
[in]p_paramsArguments to the workload parameters to use for this benchmark. It is ignored if workload does not support parameters.
Returns
A pointer to the base benchmark class of the instantiated benchmark to be wrapped by a handle that will cross the API Bridge boundary.

◆ destroyBenchmark()

virtual void hebench::cpp::BenchmarkDescription::destroyBenchmark ( BaseBenchmark p_bench)
pure virtual

Destroys and frees resources held by a BaseBenchmark (or derived) object previously created by createBenchmark().

Parameters
[in]p_benchPointer to benchmark object to destroy.

◆ getBenchmarkDescription()

std::string hebench::cpp::BenchmarkDescription::getBenchmarkDescription ( const hebench::APIBridge::WorkloadParams p_w_params) const
virtual

Retrieves human-readable description specific to the represented benchmark.

Returns
A string containing the human-readable description for the benchmark as specified by hebench::APIBridge::getBenchmarkDescriptionEx().

Default implementation returns an empty string. Derived classes should override this method and return appropriate description. The description will be inserted in a CSV formatted output, so, derived classes can take advantage of this knowledge to format the description as appropriate.

See also
hebench::APIBridge::getBenchmarkDescriptionEx()

Definition at line 17 of file benchmark.cpp.

◆ getBenchmarkDescriptor() [1/2]

const hebench::APIBridge::BenchmarkDescriptor& hebench::cpp::BenchmarkDescription::getBenchmarkDescriptor ( ) const
inline

Retrieves the HEBench benchmark descriptor represented by this BenchmarkDescription object.

Returns
A reference to the benchmark descriptor.

Definition at line 58 of file benchmark.hpp.

◆ getBenchmarkDescriptor() [2/2]

void hebench::cpp::BenchmarkDescription::getBenchmarkDescriptor ( hebench::APIBridge::BenchmarkDescriptor bench_desc) const

Retrieves the HEBench benchmark descriptor represented by this BenchmarkDescription object.

Parameters
[out]bench_descReference where to store the benchmark descriptor.

Definition at line 28 of file benchmark.cpp.

◆ getWorkloadDefaultParameters()

const std::vector<std::vector<hebench::APIBridge::WorkloadParam> >& hebench::cpp::BenchmarkDescription::getWorkloadDefaultParameters ( ) const
inline

Retrieves the sets of default arguments supported by this benchmark's workload.

Returns
A collection of sets of default arguments supported by this benchmark's workload. The collection is empty if this workload does not have parameters.

Definition at line 64 of file benchmark.hpp.

◆ getWorkloadParameterCount()

std::size_t hebench::cpp::BenchmarkDescription::getWorkloadParameterCount ( ) const

Retrieves the number of flexible parameters for this benchmark's workload.

Returns
The number of flexible parameters for this benchmark's workload, or 0 if no parameters.

This is computed based on default parameters added to the description using addDefaultParameters().

Definition at line 23 of file benchmark.cpp.

Member Data Documentation

◆ m_descriptor

hebench::APIBridge::BenchmarkDescriptor hebench::cpp::BenchmarkDescription::m_descriptor
protected

HEBench descriptor for this benchmark.

This member is to be initialized during derived class construction to reflect the appropriate benchmark description.

Definition at line 110 of file benchmark.hpp.

◆ tag

constexpr std::int64_t hebench::cpp::BenchmarkDescription::tag = 0x1000000000000000
staticconstexpr

Used to identify this class when returned as a handle to Test Harness.

See also
ITaggedObject

Definition at line 42 of file benchmark.hpp.


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