source: GTP/trunk/Lib/Vis/Preprocessing/src/Timer/BenchTimer.cpp @ 2015

Revision 2015, 2.0 KB checked in by bittner, 18 years ago (diff)

pvs efficiency tuning

  • Property svn:executable set to *
Line 
1// ===========================================================================
2//  (C) 1999 Vienna University of Technology
3// ===========================================================================
4//  NAME:       BenchTimer
5//  TYPE:       c++ code
6//  PROJECT:    Urban Viz/yare (yet another rendering engine)
7//  CONTENT:    Very accurate timer for Win32 systems
8//                              (uses QueryPerformanceCounter, usually microseconds)
9//  VERSION:    0.1
10// ===========================================================================
11//  AUTHORS:    mw      Michael Wimmer
12// ===========================================================================
13//  HISTORY:
14//
15//  15-jul-99 14:00:00  mw      created
16// ===========================================================================
17//  $Header: /usr/local/cvsyare/cvsyamp/src/yareutils/BenchTimer.cpp,v 1.1 2002/11/14 15:22:58 wimmer Exp $
18// ===========================================================================
19
20#ifdef WIN32
21
22#include "BenchTimer.h"
23
24#include "merror.h"
25
26// ---------------------------------------------------------------------------
27//  class BenchTimer implementation
28// ---------------------------------------------------------------------------
29
30
31LARGE_INTEGER BenchTimer::frequency;
32bool BenchTimer::isinitialized = false;
33bool BenchTimer::available = false;
34
35// this retrieves the timer frequency - will be called by constructor
36void BenchTimer::InitClass(bool verbose)
37{
38        if (QueryPerformanceFrequency(&frequency))
39        {
40                available = true;
41                if (verbose)
42                        //OUT1(SV(double(frequency.QuadPart)));
43                        OUT1("QueryPerformanceCounter Frequency: " << double(frequency.QuadPart));
44        }
45        else
46        {
47                EOUT("No high resolution perfomance counter installed!");
48                available = false;
49                frequency.QuadPart = 1;
50        }
51
52        isinitialized = true;
53}
54
55/// returns the frequency
56double BenchTimer::GetFrequency(bool verbose)
57{
58        if (!isinitialized)
59                InitClass(verbose);
60       
61        return double(frequency.QuadPart);
62}
63
64#endif // WIN32
Note: See TracBrowser for help on using the repository browser.