diff options
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-30 16:32:56 +0900 |
---|---|---|
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-07-01 22:02:04 +0900 |
commit | b123fe50d41b8bd4236959ad486bf78991389e4d (patch) | |
tree | ba4c81ef201db6f2d1905d54a302d8d69fa16c84 /stats.h | |
parent | 6b1a11a4ca6565bd2ad49bd4ab9067c45ed95387 (diff) | |
download | kati-b123fe50d41b8bd4236959ad486bf78991389e4d.tar.gz |
[C++] Report particularly slow shell commands
Diffstat (limited to 'stats.h')
-rw-r--r-- | stats.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -27,7 +27,7 @@ class Stats { private: void Start(); - void End(); + double End(); friend class ScopedStatsRecorder; @@ -38,11 +38,12 @@ class Stats { class ScopedStatsRecorder { public: - explicit ScopedStatsRecorder(Stats* st); + explicit ScopedStatsRecorder(Stats* st, const char* msg = 0); ~ScopedStatsRecorder(); private: Stats* st_; + const char* msg_; }; void ReportAllStats(); @@ -51,4 +52,8 @@ void ReportAllStats(); static Stats stats(name); \ ScopedStatsRecorder ssr(&stats) +#define COLLECT_STATS_WITH_SLOW_REPORT(name, msg) \ + static Stats stats(name); \ + ScopedStatsRecorder ssr(&stats, msg) + #endif // STATS_H_ |