OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utiltools / X86MAC64 / cuda / samples / 7_CUDALibraries / common / UtilNPP / StopWatchWin.cpp
1 /**
2  * Copyright 1993-2013 NVIDIA Corporation.  All rights reserved.
3  *
4  * Please refer to the NVIDIA end user license agreement (EULA) associated
5  * with this source code for terms and conditions that govern your use of
6  * this software. Any use, reproduction, disclosure, or distribution of
7  * this software and related documentation outside the terms of the EULA
8  * is strictly prohibited.
9  *
10  */
11
12 /* Cuda UTility Library */
13
14 // includes, file
15 #include "StopWatchWin.h"
16
17 ////////////////////////////////////////////////////////////////////////////////
18 // Variables, static
19
20 namespace npp
21 {
22     double StopWatchWin::freq;
23
24     bool   StopWatchWin::freq_set;
25
26     StopWatchWin::StopWatchWin() :
27         start_time(),
28         end_time(),
29         diff_time(0.0),
30         total_time(0.0),
31         running(false)
32     {
33         if (! freq_set)
34         {
35             // helper variable
36             LARGE_INTEGER temp;
37
38             // get the tick frequency from the OS
39             QueryPerformanceFrequency((LARGE_INTEGER *) &temp);
40
41             // convert to type in which it is needed
42             freq = ((double) temp.QuadPart) / 1000.0;
43
44             // rememeber query
45             freq_set = true;
46         }
47     }
48
49     StopWatchWin::~StopWatchWin() { }
50
51 } // npp namespace