diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:42 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:42 +0200 |
commit | c32707148292d104c66276b43796d6057c8c7a5d (patch) | |
tree | bb83513f4aff24153e21a4ec92e34e4c27651b1f /shared/perf.h | |
parent | 3.9 (diff) | |
download | FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.gz FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.bz2 FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.zip |
3.10
Diffstat (limited to 'shared/perf.h')
-rw-r--r-- | shared/perf.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/shared/perf.h b/shared/perf.h index 62473259..e4e279bb 100644 --- a/shared/perf.h +++ b/shared/perf.h @@ -4,13 +4,23 @@ // * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // -#include <windows.h> +#ifndef DEBUG_PERF_HEADER +#define DEBUG_PERF_HEADER + +//#define WIN32_LEAN_AND_MEAN -> not in a header +#include <wx/msw/wrapwin.h> //includes "windows.h" #include <sstream> +#ifdef __MINGW32__ + #define DEPRECATED(x) x __attribute__ ((deprecated)) +#elif defined _MSC_VER + #define DEPRECATED(x) __declspec(deprecated) x +#endif + class Performance { public: - Performance() : resultWasShown(false), startTime(::GetTickCount()) {} + DEPRECATED(Performance()) : resultWasShown(false), startTime(::GetTickCount()) {} ~Performance() { @@ -20,18 +30,16 @@ public: void showResult() { - resultWasShown = true; - - const DWORD currentTime = ::GetTickCount(); - const DWORD delta = currentTime - startTime; - startTime = currentTime; - + const DWORD delta = ::GetTickCount() - startTime; std::ostringstream ss; ss << delta << " ms"; - + ::MessageBoxA(NULL, ss.str().c_str(), "Timer", 0); - } + resultWasShown = true; + startTime = ::GetTickCount(); //don't include call to MessageBox()! + } + private: bool resultWasShown; DWORD startTime; @@ -40,3 +48,5 @@ private: //two macros for quick performance measurements #define PERF_START Performance a; #define PERF_STOP a.showResult(); + +#endif //DEBUG_PERF_HEADER
\ No newline at end of file |