diff options
author | lloyd <[email protected]> | 2008-10-22 06:18:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-22 06:18:47 +0000 |
commit | ae84bfb0abbf2e184bfcfa61bc96650b6fd4a041 (patch) | |
tree | 5b9939a9965233eddfc3acf8006020fb5b865e67 /checks/timer.h | |
parent | 4baf2b9ef44790fb2b643ef2cdb4101b7be43c3b (diff) |
Avoid integer overflows in the benchmark timer code. This would lead to
bad results, especially noticable with fast algorithms and long test times.
Diffstat (limited to 'checks/timer.h')
-rw-r--r-- | checks/timer.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/checks/timer.h b/checks/timer.h index 4bdc08154..48d6b6805 100644 --- a/checks/timer.h +++ b/checks/timer.h @@ -27,12 +27,12 @@ class Timer double ms_per_event() { return milliseconds() / events(); } double seconds_per_event() { return seconds() / events(); } - u32bit events() const { return event_count * event_mult; } + u64bit events() const { return event_count * event_mult; } std::string get_name() const { return name; } private: std::string name; u64bit time_used, timer_start; - u32bit event_count, event_mult; + u64bit event_count, event_mult; }; inline bool operator<(const Timer& x, const Timer& y) |