# WinPerfClock.cc

Go to the documentation of this file.

    00001 #include "WinPerfClock.hh"
    00002 #include <iostream>
    00003 #include <stdlib.h>
    00004 #include <string.h>
    00005 #include <time.h>
    00006
    00007 namespace certi {
    00008
    00009 WinPerfClock::WinPerfClock() : Clock("WinPerfClock")
    00010 {
    00011 LARGE_INTEGER freq;
    00012 if (QueryPerformanceFrequency(&freq))
    00013     {
    00014     std::cout << "Perffreq = " << freq.QuadPart <<std::endl;
    00015     resolution = 1.0e9 / static_cast<double>(freq.QuadPart);
    00016     }
    00017 else    resolution = 0.0 ;
    00018 }
    00019
    00020 double WinPerfClock::getResolution()
    00021 {
    00022 return resolution;
    00023 }
    00024
    00025 uint64_t WinPerfClock::getCurrentTicksValue()
    00026 {
    00027    LARGE_INTEGER tick;
    00028     QueryPerformanceCounter(&tick);
    00029     return static_cast<uint64_t>(tick.QuadPart);
    00030 }
    00031
    00032 double WinPerfClock::tick2NanoSecond(const uint64_t ticks)
    00033 {
    00034 return resolution*ticks;
    00035 }
    00036
    00037 WinPerfClock::~WinPerfClock()
    00038 {
    00039 }
    00040
    00041 }