summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-07-27 15:14:02 +0200
committerClifford Wolf <clifford@clifford.at>2014-07-27 15:14:02 +0200
commitddd31a0b66259a458f7bfb3475f53c30aa859bc8 (patch)
treefb5b49a2f0d0ba9a70f20c919d42873d44d84b4f
parent77a1462f2d6602d5c46a2a15ca534550ec5bb9a4 (diff)
Small improvements in PerformanceTimer API
-rw-r--r--kernel/log.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/log.h b/kernel/log.h
index abfb810f..ca1e7c67 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -199,12 +199,12 @@ struct PerformanceTimer
total_ns = 0;
}
- void add() {
- total_ns += query();
+ void begin() {
+ total_ns -= query();
}
- void sub() {
- total_ns -= query();
+ void end() {
+ total_ns += query();
}
float sec() const {
@@ -212,8 +212,8 @@ struct PerformanceTimer
}
#else
void reset() { }
- void add() { }
- void sub() { }
+ void begin() { }
+ void end() { }
float sec() const { return 0; }
#endif
};
@@ -235,6 +235,7 @@ static inline void log_dump_val_worker(double v) { log("%f", v); }
static inline void log_dump_val_worker(const char *v) { log("%s", v); }
static inline void log_dump_val_worker(std::string v) { log("%s", v.c_str()); }
static inline void log_dump_val_worker(RTLIL::SigSpec v) { log("%s", log_signal(v)); }
+static inline void log_dump_val_worker(PerformanceTimer p) { log("%f seconds", p.sec()); }
static inline void log_dump_args_worker(const char *p) { log_assert(*p == 0); }
template<typename T>