Mali OpenGL ES SDK  2.0.0
A simple framework to aid development of OpenGL ES applications targeting ARM Mali platforms.
 All Classes Files Functions Variables Enumerations Enumerator
Timer.h
1 /*
2  * This proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2012 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10 
11 #ifndef TIMER_H
12 #define TIMER_H
13 
14 #include <cstdio>
15 
16 #if defined(_WIN32)
17 #else
18 #include <sys/time.h>
19 #endif
20 
21 namespace MaliSDK
22 {
27  class Timer
28  {
29  private:
30  int frameCount;
31  float fps;
32  float lastTime;
33  #if defined(_WIN32)
34  double resetStamp;
35  double invFreq;
36  float lastInterval;
37  float lastFpsUpdate;
38  #else
39  timeval startTime;
40  timeval currentTime;
41  float lastIntervalTime;
42  float fpsTime;
43  #endif
44  public:
48  Timer();
49 
53  void reset();
54 
59  float getTime();
60 
67  float getInterval();
68 
75  float getFPS();
76 
83  bool isTimePassed(float seconds = 1.0f);
84  };
85 }
86 #endif /* TIMER_H */