summaryrefslogtreecommitdiff
path: root/zen/perf.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2015-10-02 14:52:29 +0200
committerDaniel Wilhelm <daniel@wili.li>2015-10-02 14:52:29 +0200
commitd3e1925aa7388cd842408032621fae29133dd971 (patch)
tree02e0bd2fdc4bf0214d15c829d9ad5eebb0a03d38 /zen/perf.h
parent6.8 (diff)
downloadFreeFileSync-d3e1925aa7388cd842408032621fae29133dd971.tar.gz
FreeFileSync-d3e1925aa7388cd842408032621fae29133dd971.tar.bz2
FreeFileSync-d3e1925aa7388cd842408032621fae29133dd971.zip
6.9
Diffstat (limited to 'zen/perf.h')
-rw-r--r--zen/perf.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/zen/perf.h b/zen/perf.h
index ccaa3f07..4405537c 100644
--- a/zen/perf.h
+++ b/zen/perf.h
@@ -4,8 +4,8 @@
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
// **************************************************************************
-#ifndef DEBUG_PERF_HEADER
-#define DEBUG_PERF_HEADER
+#ifndef DEBUG_PERF_HEADER_83947184145342652456
+#define DEBUG_PERF_HEADER_83947184145342652456
#include "deprecate.h"
#include "tick_count.h"
@@ -30,14 +30,10 @@ public:
ZEN_DEPRECATE
PerfTimer() : //throw TimerError
- ticksPerSec_(ticksPerSec()), startTime(), resultShown(false)
+ ticksPerSec_(ticksPerSec()), startTime(getTicks()), resultShown(false)
{
- //std::clock() - "counts CPU time in C and wall time in VC++" - WTF!???
-#ifdef ZEN_WIN
- if (::SetThreadAffinityMask(::GetCurrentThread(), 1) == 0) //"should not be required unless there are bugs in BIOS or HAL" - msdn, QueryPerformanceCounter
- throw TimerError();
-#endif
- startTime = getTicks();
+ //std::clock() - "counts CPU time in Linux GCC and wall time in VC++" - WTF!???
+
if (ticksPerSec_ == 0 || !startTime.isValid())
throw TimerError();
}
@@ -50,7 +46,7 @@ public:
if (!now.isValid())
throw TimerError();
- const auto delta = static_cast<long>(1000.0 * dist(startTime, now) / ticksPerSec_);
+ const std::int64_t delta = 1000 * dist(startTime, now) / ticksPerSec_;
#ifdef ZEN_WIN
std::ostringstream ss;
ss << delta << " ms";
@@ -72,4 +68,4 @@ private:
};
}
-#endif //DEBUG_PERF_HEADER
+#endif //DEBUG_PERF_HEADER_83947184145342652456
bgstack15