Fabcoin Core  0.16.2
P2P Digital Currency
Stats.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #pragma once
19 
20 #include <chrono>
21 #include <vector>
22 
23 #include "TestHelper.h"
24 
25 namespace dev
26 {
27 namespace test
28 {
29 
30 class Stats: public Listener
31 {
32 public:
33  using clock = std::chrono::high_resolution_clock;
34 
35  struct Item
36  {
38  int64_t gasUsed;
39  std::string name;
40  };
41 
42  static Stats& get();
43 
44  ~Stats();
45 
46  void suiteStarted(std::string const& _name) override;
47  void testStarted(std::string const& _name) override;
48  void testFinished(int64_t _gasUsed) override;
49 
50 private:
52  std::string m_currentSuite;
53  std::string m_currentTest;
54  std::vector<Item> m_stats;
55 };
56 
57 }
58 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
Allows observing test execution process.
Definition: TestHelper.h:174
clock::time_point m_tp
Definition: Stats.h:51
std::string m_currentTest
Definition: Stats.h:53
void suiteStarted(std::string const &_name) override
Definition: Stats.cpp:35
std::string m_currentSuite
Definition: Stats.h:52
clock::duration duration
Definition: bench.h:50
std::string name
Definition: Stats.h:39
std::chrono::high_resolution_clock clock
Definition: Stats.h:33
void testStarted(std::string const &_name) override
Definition: Stats.cpp:40
clock::time_point time_point
Definition: bench.h:49
void testFinished(int64_t _gasUsed) override
Definition: Stats.cpp:46
clock::duration duration
Definition: Stats.h:37
std::vector< Item > m_stats
Definition: Stats.h:54
Helper functions to work with json::spirit and test files.