File: workload.hpp

package info (click to toggle)
xenium 0.0.2%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,088 kB
  • sloc: cpp: 12,297; makefile: 20
file content (22 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <tao/config/value.hpp>

struct workload_simulator {
  virtual ~workload_simulator() = default;
  virtual void simulate() = 0;
};

class workload_factory {
public:
  workload_factory();
  std::shared_ptr<workload_simulator> operator()(const tao::config::value& config);
  using builder = std::function<std::shared_ptr<workload_simulator>(const tao::config::value&)>;
  void register_workload(std::string type, builder func);
private:
  std::unordered_map<std::string, builder> _builders;
};