diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-13 18:19:26 +0800 |
---|---|---|
committer | Paweł Bylica <chfast@gmail.com> | 2015-03-14 07:18:52 +0800 |
commit | 31db4fbde86ede91b3af9336d7632e4c700960d6 (patch) | |
tree | 9eed19c85fde75a779d2895137fc54b4c60a5f0a /TestHelper.h | |
parent | f15e1ef250dc9c2c32a2857d36920369ac5e62ce (diff) | |
download | dexon-solidity-31db4fbde86ede91b3af9336d7632e4c700960d6.tar.gz dexon-solidity-31db4fbde86ede91b3af9336d7632e4c700960d6.tar.zst dexon-solidity-31db4fbde86ede91b3af9336d7632e4c700960d6.zip |
Stats for testeth
Simple listener support added to testeth. Stats class implements the Listener interface and collects tests execution times. Try options: --stats or --stats=full.
Closes ethereum/cpp-ethereum#1285
Diffstat (limited to 'TestHelper.h')
-rw-r--r-- | TestHelper.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/TestHelper.h b/TestHelper.h index 9efed0fa..ade20f5e 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -162,8 +162,9 @@ class Options public: bool jit = false; ///< Use JIT bool vmtrace = false; ///< Create EVM execution tracer // TODO: Link with log verbosity? - bool showTimes = false; ///< Print test groups execution times bool fillTests = false; ///< Create JSON test files from execution results + bool stats = false; ///< Execution time stats + bool statsFull = false; ///< Output full stats - execution times for every test /// Test selection /// @{ @@ -183,5 +184,32 @@ private: Options(Options const&) = delete; }; +/// Allows observing test execution process. +/// This class also provides methods for registering and notifying the listener +class Listener +{ +public: + virtual ~Listener() = default; + + virtual void testStarted(std::string const& _name) = 0; + virtual void testFinished() = 0; + + static void registerListener(Listener& _listener); + static void notifyTestStarted(std::string const& _name); + static void notifyTestFinished(); + + /// Test started/finished notification RAII helper + class ExecTimeGuard + { + public: + ExecTimeGuard(std::string const& _testName) { notifyTestStarted(_testName); } + ~ExecTimeGuard() { notifyTestFinished(); } + ExecTimeGuard(ExecTimeGuard const&) = delete; + ExecTimeGuard& operator=(ExecTimeGuard) = delete; + }; +}; + + + } } |