00001 #ifndef UTILITIES_TIMING_PENTIUMTIMER_H
00002 #define UTILITIES_TIMING_PENTIUMTIMER_H
00003
00004
00005
00006
00007
00008
00009 #ifdef __linux__
00010
00011 #include "Utilities/Timing/interface/GenTimer.h"
00012
00013 typedef unsigned long long int PentiumTimeType;
00014 typedef long long int PentiumTimeIntervalType;
00015
00016 extern "C" inline PentiumTimeType rdtscPentium() {
00017 PentiumTimeType x;
00018 __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
00019 return x;
00020 }
00021
00022
00023
00024 struct PentiumTime {
00025
00026 struct OneTick {
00027 OneTick();
00028 ~OneTick();
00029
00030 double one;
00031 };
00032
00033 static double oneTick() {
00034 static OneTick local;
00035 return local.one;
00036 };
00037
00038 typedef GenTimeInterval<PentiumTime> TimeInterval;
00039 typedef PentiumTimeIntervalType IntervalType;
00040 typedef PentiumTimeType TimeType;
00041
00042 inline static TimeType time() { return rdtscPentium();}
00043 inline static TimeType time(int) { return rdtscPentium();}
00044
00045 };
00046
00047
00051 typedef GenTimer<PentiumTime> PentiumTimer;
00052
00053
00054 template<>
00055 inline
00056 GenTimer<PentiumTime>::GenTimer() : elapsed(0), running_(0), pid(0) {}
00057
00058 #endif // __linux__
00059 #endif // UTILITIES_TIMING_PENTIUMTIMER_H