Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: sandbox_light/src/external/ogremath/WIN32/OgreTimerImp.h @ 7324

Last change on this file since 7324 was 5789, checked in by rgrieder, 15 years ago

Stripped sandbox further down to get a light version that excludes almost all core features.
Also, the Ogre dependency has been removed and a little ogremath library been added.

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __Win32Timer_H__
30#define __Win32Timer_H__
31
32#include <ctime>
33
34#ifndef WIN32_LEAN_AND_MEAN
35#  define WIN32_LEAN_AND_MEAN
36#endif
37#include "windows.h"
38
39//Get around Windows hackery
40#ifdef max
41#  undef max
42#endif
43#ifdef min
44#  undef min
45#endif
46
47namespace Ogre
48{
49        class _OgreExport Timer
50    {
51    private:
52                clock_t mZeroClock;
53
54        DWORD mStartTick;
55                LONGLONG mLastTime;
56        LARGE_INTEGER mStartTime;
57        LARGE_INTEGER mFrequency;
58
59                DWORD mTimerMask;
60    public:
61                /** Timer constructor.  MUST be called on same thread that calls getMilliseconds() */
62                Timer();
63                ~Timer();
64
65                /** Method for setting a specific option of the Timer. These options are usually
66            specific for a certain implementation of the Timer class, and may (and probably
67            will) not exist across different implementations.  reset() must be called after
68                        all setOption() calls.
69                        @par
70                        Current options supported are:
71                        <ul><li>"QueryAffinityMask" (DWORD): Set the thread affinity mask to be used
72                        to check the timer. If 'reset' has been called already this mask should
73                        overlap with the process mask that was in force at that point, and should
74                        be a power of two (a single core).</li></ul>
75            @param
76                strKey The name of the option to set
77            @param
78                pValue A pointer to the value - the size should be calculated by the timer
79                based on the key
80            @return
81                On success, true is returned.
82            @par
83                On failure, false is returned.
84        */
85        bool setOption( const String& strKey, const void* pValue );
86
87                /** Resets timer */
88                void reset();
89
90                /** Returns milliseconds since initialisation or last reset */
91                unsigned long getMilliseconds();
92
93                /** Returns microseconds since initialisation or last reset */
94                unsigned long getMicroseconds();
95
96                /** Returns milliseconds since initialisation or last reset, only CPU time measured */ 
97                unsigned long getMillisecondsCPU();
98
99                /** Returns microseconds since initialisation or last reset, only CPU time measured */ 
100                unsigned long getMicrosecondsCPU();
101    };
102} 
103#endif
Note: See TracBrowser for help on using the repository browser.