ETL
0.04.19
Main Page
Related Pages
Classes
Files
File List
File Members
ETL
_clock_win32hpcount.h
Go to the documentation of this file.
1
25
/* === S T A R T =========================================================== */
26
27
#ifndef __ETL__CLOCK_WIN32HPCOUNT_H
28
#define __ETL__CLOCK_WIN32HPCOUNT_H
29
30
/* === H E A D E R S ======================================================= */
31
32
#define WIN32_LEAN_AND_MEAN
33
#include <windows.h>
34
35
/* === M A C R O S ========================================================= */
36
37
#if defined(__GNUG__) && defined(__int64)
38
#undef __int64
39
#define __int64 long long int
40
#endif
41
42
/* === T Y P E D E F S ===================================================== */
43
44
/* === C L A S S E S & S T R U C T S ======================================= */
45
46
_ETL_BEGIN_NAMESPACE
47
48
class
clock_desc_win32hpcount
49
{
50
public
:
51
typedef
double
value_type
;
52
53
static
bool
realtime
()
54
{
return
true
; }
55
56
static
bool
proctime
()
57
{
return
false
; }
58
59
static
value_type
60
one_second
()
61
{
return
1.0f; }
62
63
static
value_type
precision
()
64
{
65
__int64 freq;
66
QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
67
return
one_second
()/(
value_type
)freq;
68
}
69
70
static
const
char
*
description
()
71
{
return
"Win32 QueryPerformanceCounter()"
; };
72
73
protected
:
74
typedef
__int64
timestamp
;
75
76
static
void
77
get_current_time
(
timestamp
&x)
78
{ QueryPerformanceCounter((LARGE_INTEGER*)&x);}
79
80
static
timestamp
81
get_current_time
()
82
{
timestamp
ret; QueryPerformanceCounter((LARGE_INTEGER*)&ret);
return
ret; }
83
84
static
value_type
85
timestamp_to_seconds
(
const
timestamp
&x)
86
{
return
precision
()*x; }
87
88
static
timestamp
89
seconds_to_timestamp
(
const
value_type
&x)
90
{
return
(
timestamp
)(x/
precision
()); }
91
};
92
93
_ETL_END_NAMESPACE
94
95
/* === E N D =============================================================== */
96
97
#endif
98
Generated on Mon Nov 16 2015 15:32:02 for ETL by
1.8.1.2