HEBench
generic_wl_engine.cpp
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
6 
7 #include "../include/generic_wl_engine.h"
8 #include <cstring>
9 
10 // include all benchmarks
11 #include "../include/generic_wl_benchmark.h"
12 
13 //-----------------
14 // Engine creation
15 //-----------------
16 
17 namespace hebench {
18 namespace cpp {
19 
20 BaseEngine *createEngine()
21 {
22  return ExampleEngine::create();
23 }
24 
25 void destroyEngine(BaseEngine *p)
26 {
27  ExampleEngine *_p = dynamic_cast<ExampleEngine *>(p);
28  ExampleEngine::destroy(_p);
29 }
30 
31 } // namespace cpp
32 } // namespace hebench
33 
34 //---------------------
35 // class ExampleEngine
36 //---------------------
37 
38 ExampleEngine *ExampleEngine::create()
39 {
40  ExampleEngine *p_retval = new ExampleEngine();
41  p_retval->init();
42  return p_retval;
43 }
44 
45 void ExampleEngine::destroy(ExampleEngine *p)
46 {
47  if (p)
48  delete p;
49 }
50 
51 ExampleEngine::ExampleEngine()
52 {
53 }
54 
55 ExampleEngine::~ExampleEngine()
56 {
57 }
58 
59 void ExampleEngine::init()
60 {
61  // add any new error codes: use
62 
63  // this->addErrorCode(code, "generic description");
64 
65  // add supported schemes
66 
67  addSchemeName(HEBENCH_HE_SCHEME_PLAIN, "Plain");
68 
69  // add supported security
70 
71  addSecurityName(HEBENCH_HE_SECURITY_NONE, "None");
72 
73  // add the all benchmark descriptors
74  addBenchmarkDescription(std::make_shared<ExampleBenchmarkDescription>(hebench::APIBridge::Category::Latency));
75  addBenchmarkDescription(std::make_shared<ExampleBenchmarkDescription>(hebench::APIBridge::Category::Offline));
76 }
77 
BaseEngine * createEngine(const std::int8_t *p_buffer, std::uint64_t size)
Creates a new BaseEngine object.
void destroyEngine(BaseEngine *p)
Destroys and cleans up resources from an engine created by createEngine().