CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PentiumTimer.h
Go to the documentation of this file.
1 #ifndef UTILITIES_TIMING_PENTIUMTIMER_H
2 #define UTILITIES_TIMING_PENTIUMTIMER_H
3 //
4 //
5 // V 0.0
6 //
7 
9 
10 typedef unsigned long long int PentiumTimeType;
11 typedef long long int PentiumTimeIntervalType;
12 
13 extern "C" inline PentiumTimeType rdtscPentium() {
15  // Works only for x86 machines in protected mode.
16  __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
17  return x;
18 }
19 
20 
21 
22 struct PentiumTime {
23 
24  struct OneTick {
25  OneTick();
26  ~OneTick();
27 
28  double one;
29  };
30 
31  static double oneTick() {
32  static OneTick local;
33  return local.one;
34  };
35 
39 
40  inline static TimeType time() { return rdtscPentium();}
41  inline static TimeType time(int) { return rdtscPentium();}
42 
43 };
44 
45 
50 
51 
52 template<>
53 inline
54 GenTimer<PentiumTime>::GenTimer() : elapsed(0), running_(0), pid(0) {}
55 
56 #endif // UTILITIES_TIMING_PENTIUMTIMER_H
GenTimer()
constructor
Definition: GenTimer.h:87
static double oneTick()
Definition: PentiumTimer.h:31
static TimeType time(int)
Definition: PentiumTimer.h:41
static TimeType time()
Definition: PentiumTimer.h:40
PentiumTimeType TimeType
Definition: PentiumTimer.h:38
PentiumTimeIntervalType IntervalType
Definition: PentiumTimer.h:37
unsigned long long int PentiumTimeType
Definition: PentiumTimer.h:10
long long int PentiumTimeIntervalType
Definition: PentiumTimer.h:11
GenTimer< PentiumTime > PentiumTimer
Definition: PentiumTimer.h:49
GenTimeInterval< PentiumTime > TimeInterval
Definition: PentiumTimer.h:34
PentiumTimeType rdtscPentium()
Definition: PentiumTimer.h:13
x
Definition: VDTMath.h:216