VR-Exchange 2.2 API Documentation
frameTimer.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2013 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <namespace.h>
13 
14 #include <vlutil/vlTime.h>
15 
16 #include <map>
17 
18 class DtString;
19 
20 namespace MAKVrExchange
21 {
22 
23  class DtPortalConnection;
24 
25  class DT_DLL_BROKER DtFrameTimer
26  {
27  public:
28 
30  typedef DtFrameTimer* (*DtFrameTimerCreator)( DtPortalConnection* );
31 
34  {
43  USER_START
44  };
45 
47  struct SectionInfo
48  {
50  : startTime( -1 )
51  , duration( -1 )
52  , avgDuration( 0 )
53  , avgPercent( 0 )
54  {
55  }
56 
57  DtTime startTime; // Time the last section started.
58  DtTime duration; // Duration of the last section.
59  DtTime avgDuration; // Avg duration of section (or sum so far if still processing).
60  double avgPercent; // Avg percent of frame spent in section (or sum so far if still processing).
61  };
62 
64  typedef std::map<FrameSectionType,SectionInfo> SectionInfoMap;
65 
66  public:
67 
72  static DtFrameTimerCreator theFrameTimerCreator;
73 
75  static DtFrameTimer* create( DtPortalConnection* portalConn );
76 
78  virtual ~DtFrameTimer();
79 
81  virtual void markFrameStart();
82 
84  virtual void markFrameEnd();
85 
87  virtual void markStart( FrameSectionType section );
88 
90  virtual void markEnd( FrameSectionType section );
91 
95  virtual void generateReport();
96 
98  virtual void printFrameStatistics();
99 
103  virtual const SectionInfoMap& sectionInfo() const;
104 
108  virtual double fps() const;
109 
110  protected:
111 
113  DtFrameTimer( DtPortalConnection* portalConn );
114 
116  virtual DtString roundPercent( double percent );
117 
118  protected:
119 
121 
122  unsigned int myFrameCounter;
123  unsigned int myLastFrameCount;
125  double myFps;
126 
128 
129  };
130 
131 }

Document ID: Generated on Mon Apr 15 17:15:50 EDT 2013 from SVN revision 126154
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)