HEBench
hebench::TestHarness::Engine Class Reference

#include <hebench_engine.h>

Inheritance diagram for hebench::TestHarness::Engine:
Collaboration diagram for hebench::TestHarness::Engine:

Public Types

typedef std::shared_ptr< EnginePtr
 

Public Member Functions

std::string getErrorDescription (hebench::APIBridge::ErrorCode err_code) const
 
void validateRetCode (hebench::APIBridge::ErrorCode err_code, bool last_error=true) const
 
virtual ~Engine ()
 
std::string getSchemeName (hebench::APIBridge::Scheme s) const
 
std::string getSecurityName (hebench::APIBridge::Scheme s, hebench::APIBridge::Security sec) const
 
std::string getExtraDescription (hebench::APIBridge::Handle h_bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const
 
std::size_t countBenchmarks () const
 Number of benchmarks for which backend is registered to perform. More...
 
IBenchmark::Ptr createBenchmark (IBenchmarkDescriptor::DescriptionToken::Ptr p_token, hebench::Utilities::TimingReportEx &out_report)
 Creates the the benchmark workload represented by the specified token. More...
 
IBenchmarkDescriptor::DescriptionToken::Ptr describeBenchmark (std::size_t index, const BenchmarkDescription::Configuration &config) const
 Describes a benchmark workload that matches the specified description from the benchmarks registered by the backend. More...
 
std::vector< std::vector< hebench::APIBridge::WorkloadParam > > getDefaultWorkloadParams (std::size_t index) const
 Retrieves the list of default parameters for a workload as specified by the backend. More...
 
std::string getLastErrorDescription () const
 
const hebench::APIBridge::Handlehandle () const
 

Static Public Member Functions

static void completeBenchmarkDescriptor (hebench::TestHarness::BenchmarkDescription::Backend &backend_description, const hebench::APIBridge::BenchmarkDescriptor &completed_descriptor)
 Grants a guarded write access to hebench::TestHarness::BenchmarkDescription::Backend::m_descriptor::cat_params. More...
 
static Engine::Ptr create (const std::vector< std::int8_t > &data)
 Creates a new backend engine. More...
 

Detailed Description

Definition at line 22 of file hebench_engine.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<Engine> hebench::TestHarness::Engine::Ptr

Definition at line 31 of file hebench_engine.h.

Constructor & Destructor Documentation

◆ ~Engine()

hebench::TestHarness::Engine::~Engine ( )
virtual

Definition at line 106 of file hebench_engine.cpp.

Member Function Documentation

◆ completeBenchmarkDescriptor()

void hebench::TestHarness::Engine::completeBenchmarkDescriptor ( hebench::TestHarness::BenchmarkDescription::Backend backend_description,
const hebench::APIBridge::BenchmarkDescriptor completed_descriptor 
)
static

Grants a guarded write access to hebench::TestHarness::BenchmarkDescription::Backend::m_descriptor::cat_params.

Parameters
backend_descriptionBackend description to complete. All members of hebench::TestHarness::BenchmarkDescription::Backend::descriptor must be set, except for, perhaps, cat_params which will be overwriten in this call.
[in]completed_descriptorDescriptor from which to copy the cat_params. All other fields must match that of backend_description .descriptor.
Exceptions
Instanceof std::exception if input and output descriptors are incompatible.

If both backend descriptors are compatible, this method copies the category parameters from completed_descriptor to backend_descriptor .

Definition at line 198 of file hebench_engine.cpp.

◆ countBenchmarks()

std::size_t hebench::TestHarness::Engine::countBenchmarks ( ) const
inline

Number of benchmarks for which backend is registered to perform.

Definition at line 71 of file hebench_engine.h.

◆ create()

Engine::Ptr hebench::TestHarness::Engine::create ( const std::vector< std::int8_t > &  data)
static

Creates a new backend engine.

Parameters
[in]dataExternal data to pass to the backend engine for initialization, if any. Otherwise, empty array.
Returns
A pointer to the engine wrapper.

This method calls APIBridge::initEngine() passing the specified data to create and initialize the loaded backend engine.

Definition at line 58 of file hebench_engine.cpp.

◆ createBenchmark()

IBenchmark::Ptr hebench::TestHarness::Engine::createBenchmark ( IBenchmarkDescriptor::DescriptionToken::Ptr  p_token,
hebench::Utilities::TimingReportEx out_report 
)

Creates the the benchmark workload represented by the specified token.

Parameters
[in]p_tokenToken of the described benchmark workload as returned by describeBenchmark(). Cannot be null.
Returns
Smart pointer to the created benchmark workload.
Exceptions
std::logic_errorwhen creating a new benchmark without destroying previously existing benchmark.
std::invalid_argumenton invalid p_token.

As long as the returned benchmark exists, this engine cannot be destroyed. This method ensures that only one benchmark from this engine exists at a time.

The returned object is to be used by Test Harness to execute the benchmark.

Definition at line 167 of file hebench_engine.cpp.

◆ describeBenchmark()

IBenchmarkDescriptor::DescriptionToken::Ptr hebench::TestHarness::Engine::describeBenchmark ( std::size_t  index,
const BenchmarkDescription::Configuration config 
) const

Describes a benchmark workload that matches the specified description from the benchmarks registered by the backend.

Parameters
[in]indexIndex of the registered backend benchmark description for which to create a benchmark workload.
[in]configConfiguration for the benchmark to describe. See details.
Returns
A token describing the benchmark to be executed given the workload and parameters.
Exceptions
Instanceof std::exception on errors.

The token returned by this method is to be used in a call to createBenchmark() to instantiate the actual benchmark to run.

The token returned by this method contains the correct full description for the benchmark.

For parameter config only the workload parameters are required to be correct. The returned token will contain the information passed on the other fields corrected to the number of operation parameters for the workload.

Definition at line 177 of file hebench_engine.cpp.

◆ getDefaultWorkloadParams()

std::vector< std::vector< hebench::APIBridge::WorkloadParam > > hebench::TestHarness::Engine::getDefaultWorkloadParams ( std::size_t  index) const

Retrieves the list of default parameters for a workload as specified by the backend.

Parameters
[in]indexIndex of the benchmark to query for default parameters.
Returns
A vector with the list of default arguments for the parameters of the workload. Vector is empty if workload does not support parameters.

Definition at line 215 of file hebench_engine.cpp.

◆ getErrorDescription()

std::string hebench::TestHarness::Engine::getErrorDescription ( hebench::APIBridge::ErrorCode  err_code) const

Definition at line 17 of file hebench_engine.cpp.

◆ getExtraDescription()

std::string hebench::TestHarness::Engine::getExtraDescription ( hebench::APIBridge::Handle  h_bench_desc,
const std::vector< hebench::APIBridge::WorkloadParam > &  w_params 
) const

Definition at line 149 of file hebench_engine.cpp.

◆ getLastErrorDescription()

std::string hebench::TestHarness::Engine::getLastErrorDescription ( ) const

Definition at line 29 of file hebench_engine.cpp.

◆ getSchemeName()

std::string hebench::TestHarness::Engine::getSchemeName ( hebench::APIBridge::Scheme  s) const

Definition at line 115 of file hebench_engine.cpp.

◆ getSecurityName()

std::string hebench::TestHarness::Engine::getSecurityName ( hebench::APIBridge::Scheme  s,
hebench::APIBridge::Security  sec 
) const

Definition at line 129 of file hebench_engine.cpp.

◆ handle()

const hebench::APIBridge::Handle& hebench::TestHarness::Engine::handle ( ) const
inline

Definition at line 122 of file hebench_engine.h.

◆ validateRetCode()

void hebench::TestHarness::Engine::validateRetCode ( hebench::APIBridge::ErrorCode  err_code,
bool  last_error = true 
) const

Definition at line 41 of file hebench_engine.cpp.


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