5 #ifndef _HEBench_Harness_IBenchmark_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_IBenchmark_H_0596d40a3cce4b108a81595c50eb286d
10 #include <unordered_set>
13 #include "hebench/modules/general/include/nocopy.h"
14 #include "hebench/modules/logging/include/logging.h"
22 namespace TestHarness {
26 class PartialBenchmark;
70 typedef std::shared_ptr<DescriptionToken>
Ptr;
79 m_backend_desc(backend_desc), m_config(config), m_description(text_desc)
257 std::size_t param_count,
258 const std::vector<std::uint64_t> &config_sample_sizes,
260 std::uint64_t default_sample_size_fallback,
334 const std::vector<hebench::APIBridge::WorkloadParam> &w_params)
const = 0;
408 static bool m_b_force_config_value;
448 typedef std::shared_ptr<IBenchmark>
Ptr;
517 typedef std::shared_ptr<PartialBenchmark>
Ptr;
521 std::weak_ptr<Engine>
getEngine()
const override {
return m_p_engine; }
547 return ++m_current_event_id;
637 std::shared_ptr<Engine> m_p_engine;
642 std::uint32_t m_current_event_id;
643 bool m_b_constructed;
644 bool m_b_initialized;
Specifies a benchmark configuration.
Token returned by a successful call to IBenchmarkDescriptor::matchBenchmarkDescriptor().
const BenchmarkDescription::Backend & getBackendDescription() const
const BenchmarkDescription::Description & getDescription() const
DescriptionToken(IBenchmarkDescriptor &caller, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config, const BenchmarkDescription::Description &text_desc, const FriendKeyCreation &)
const BenchmarkDescription::Configuration & getBenchmarkConfiguration() const
std::shared_ptr< DescriptionToken > Ptr
IBenchmarkDescriptor * getDescriptor()
Base interface for Benchmark Descriptors.
IBenchmarkDescriptor()=default
virtual void destroyBenchmark(PartialBenchmark *p_bench)=0
Destroys an object returned by createBenchmark().
DescriptionToken::Ptr createToken(const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config, const BenchmarkDescription::Description &text_desc) const
Creates a DescriptionToken object associated to this IBenchmarkDescription object using the specified...
virtual DescriptionToken::Ptr matchDescriptor(const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const =0
Determines if the represented benchmark can perform the workload described by a specified HEBench ben...
virtual PartialBenchmark * createBenchmark(std::shared_ptr< Engine > p_engine, const DescriptionToken &description_token)=0
Creates the represented IBenchmark object that can perform the workload specified by the HEBench benc...
virtual ~IBenchmarkDescriptor()=default
Interface for benchmarks.
virtual ~IBenchmark()=default
virtual bool run(hebench::Utilities::TimingReportEx &out_report, RunConfig &config)=0
Executes the benchmark operations.
virtual const hebench::APIBridge::Handle & handle() const =0
std::shared_ptr< IBenchmark > Ptr
bool b_validate_results
Specifies whether the benchmark will validate backend results (true) or it will simply benchmark with...
virtual std::weak_ptr< Engine > getEngine() const =0
Provides configuration to and retrieves data from a benchmark run.
Provides boilerplate implementation to common methods of interface IBenchmarkDescription and implemen...
std::string workload_header
Workload specific information to be added to the report header.
static std::unordered_set< std::size_t > getCipherParamPositions(std::uint32_t cipher_param_mask)
static void setForceConfigValues(bool value)
Sets whether frontend will override backend descriptors using configuration data or not.
static std::string getDataTypeName(hebench::APIBridge::DataType data_type)
virtual void completeWorkloadDescription(WorkloadDescriptionOutput &output, const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const =0
Completes the description for the matched benchmark.
PartialBenchmarkDescriptor()
static void completeCategoryParams(hebench::APIBridge::BenchmarkDescriptor &out_descriptor, const hebench::APIBridge::BenchmarkDescriptor &in_descriptor, const BenchmarkDescription::Configuration &config, bool force_config)
Completes common elements of category parameters in a descriptor using the specified configuration.
~PartialBenchmarkDescriptor() override
static std::string getCategoryName(hebench::APIBridge::Category category)
static std::uint64_t computeSampleSizes(std::uint64_t *sample_sizes, std::size_t param_count, const std::vector< std::uint64_t > &config_sample_sizes, const hebench::APIBridge::BenchmarkDescriptor &bench_desc, std::uint64_t default_sample_size_fallback, bool force_config)
Extracts the batch sizes for a workload from a specified HEBench API benchmark descriptor.
static bool getForceConfigValues()
Specifies whether frontend will override backend descriptors using configuration data or not.
DescriptionToken::Ptr matchDescriptor(const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const override final
Implementation of IBenchmarkDescriptor::matchDescriptor().
std::size_t operation_params_count
Number of parameters for the represented workload operation.
std::string workload_name
Human-readable friendly name for the represented workload to be used for its description on the repor...
hebench::APIBridge::BenchmarkDescriptor concrete_descriptor
Benchmark descriptor completed with concrete values assigned to configurable fields.
std::string workload_base_name
Human-readable friendly name for the represented workload to be used for its description on the repor...
virtual bool matchBenchmarkDescriptor(const hebench::APIBridge::BenchmarkDescriptor &bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const =0
Determines if the represented benchmark can perform the workload described by a specified HEBench ben...
Bundles values that need to be filled by a workload during completeWorkloadDescription().
Base class for benchmarks.
const BenchmarkDescription::Backend & getBackendDescription() const
Allows read-only access to this benchmark backend description.
virtual void init()=0
Initializes the partial benchmark members.
std::shared_ptr< PartialBenchmark > Ptr
~PartialBenchmark() override
virtual void postInit()
Called automatically during initialization after the backend has been initialized.
const BenchmarkDescription::Configuration & getBenchmarkConfiguration() const
Allows read-only access to this benchmark configuration.
virtual std::uint32_t getEventIDStart() const
An ID to identify the first event during the benchmark run.
const hebench::APIBridge::Handle & handle() const override
std::uint32_t getEventIDNext()
Returns the next available event ID.
const BenchmarkDescription::Description & getDescription() const
Allows read-only access to this benchmark text description.
void validateRetCode(hebench::APIBridge::ErrorCode err_code, bool last_error=true) const
Validates whether the specified HEBench API return code represents a success or error.
void checkInitializationState(const FriendPrivateKey &) const
Used to check that initialization steps have been completed successfully.
std::weak_ptr< Engine > getEngine() const override
PartialBenchmark(std::shared_ptr< Engine > p_engine, const IBenchmarkDescriptor::DescriptionToken &description_token)
void initBackend(hebench::Utilities::TimingReportEx &out_report, const FriendPrivateKey &)
Initializes backend benchmark.
DataType
Defines data types for a workload.
Category
Defines all possible categories for each workload.
std::int32_t ErrorCode
Return value for API bridge functions.
Defines a benchmark test.
Structure to contain flexible data.