1 #ifndef _PFC_PROFILER_H_ 2 #define _PFC_PROFILER_H_ 4 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) 6 #define PFC_HAVE_PROFILER 28 owner->add_time(end - start);
36 #define profiler(name) \ 37 static pfc::profiler_static profiler_static_##name(#name); \ 38 pfc::profiler_local profiler_local_##name(&profiler_static_##name); 46 #if _WIN32_WINNT >= 0x600 50 #define PFC_TICKCOUNT_32BIT 52 inline tickcount_t
getTickCount() {
return GetTickCount(); }
62 return _query( g_query() );
66 double ret = _query(current);
75 return (
double)( p_val - m_start ) / (
double) g_query_freq();
79 if (!QueryPerformanceCounter(&val))
throw pfc::exception_not_implemented();
84 if (!QueryPerformanceFrequency(&val))
throw pfc::exception_not_implemented();
102 double ret = _query(time);
111 #ifdef PFC_TICKCOUNT_32BIT 112 m_last_seen = p_time;
116 double _query(tickcount_t p_time)
const {
117 #ifdef PFC_TICKCOUNT_32BIT 119 if (time < (m_last_seen & 0xFFFFFFFF)) time += 0x100000000;
120 m_last_seen = (m_last_seen & 0xFFFFFFFF00000000) + time;
121 return (
double)(m_last_seen - m_start) / 1000.0;
123 return (
double)(p_time - m_start) / 1000.0;
127 #ifdef PFC_TICKCOUNT_32BIT 140 double query()
const;
141 double query_reset();
double _query(tickcount_t p_time) const
pfc::string8 queryString(unsigned precision=3)
void _start(tickcount_t p_time)
tickcount_t getTickCount()
pfc::string8 queryString(unsigned precision=6)
uint64_t fileTimeUtoW(uint64_t ft)
double _query(t_uint64 p_val) const
static t_uint64 g_query()
static t_uint64 g_query_freq()
profiler_local(profiler_static *p_owner)
void add_time(t_int64 delta)
uint64_t fileTimeWtoU(uint64_t ft)
profiler_static(const char *p_name)