Fabcoin Core  0.16.2
P2P Digital Currency
ExecStats.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 #include <string>
6 #include <chrono>
7 
8 namespace dev
9 {
10 namespace evmjit
11 {
12 
13 enum class ExecState
14 {
15  Started,
16  CacheLoad,
17  CacheWrite,
20  CodeGen,
21  Execution,
22  Return,
23  Finished
24 };
25 
27 {
28 public:
29  JITListener() = default;
30  JITListener(JITListener const&) = delete;
31  JITListener& operator=(JITListener) = delete;
32  virtual ~JITListener() {}
33 
34  virtual void executionStarted() {}
35  virtual void executionEnded() {}
36 
37  virtual void stateChanged(ExecState) {}
38 };
39 
40 class ExecStats : public JITListener
41 {
42 public:
43  using clock = std::chrono::high_resolution_clock;
46 
47  std::string id;
48  duration time[(int)ExecState::Finished] = {};
49 
50  void stateChanged(ExecState _state) override;
51 
52 private:
53  ExecState m_state = {};
54  time_point m_tp = {};
55 
56 };
57 
58 
60 {
61 public:
62  std::vector<std::unique_ptr<ExecStats>> stats;
63 
64  ~StatsCollector();
65 };
66 
67 }
68 }
std::chrono::high_resolution_clock clock
Definition: ExecStats.h:43
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
clock::time_point time_point
Definition: ExecStats.h:45
virtual void executionEnded()
Definition: ExecStats.h:35
clock::duration duration
Definition: bench.h:50
virtual void executionStarted()
Definition: ExecStats.h:34
virtual void stateChanged(ExecState)
Definition: ExecStats.h:37
clock::time_point time_point
Definition: bench.h:49
std::vector< std::unique_ptr< ExecStats > > stats
Definition: ExecStats.h:62
clock::duration duration
Definition: ExecStats.h:44