#ifndef TRACELINE_RDTSC_H_
#define TRACELINE_RDTSC_H_
#include <windows.h>
#include <powrprof.h>
#include <map>
#include "logging.h"
class RDTSCNormalizer {
public:
RDTSCNormalizer() { }
~RDTSCNormalizer() { }
void Start() {
LARGE_INTEGER freq, now;
if (QueryPerformanceFrequency(&freq) == 0) {
NOTREACHED("");
}
freq_ = freq.QuadPart;
if (QueryPerformanceCounter(&now) == 0) {
NOTREACHED("");
}
start_ = now.QuadPart;
}
double MsFromStart(void* procid, __int64 stamp) {
return (stamp - start_) / (freq_ / 1000.0);
}
private:
__int64 freq_;
__int64 start_;
};
#endif