VR-Exchange 2.5 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <broker/dllExport.h>
13 #include <vlutil/vlTime.h>
14 #include <map>
15 
16 class DtString;
17 
18 namespace MAKVrExchange
19 {
20 
21  class DtPortalConnection;
22 
24  {
25  public:
26 
28  typedef DtFrameTimer* (*DtFrameTimerCreator)( DtPortalConnection* );
29 
32  {
41  USER_START
42  };
43 
45  struct SectionInfo
46  {
48  : startTime( -1 )
49  , duration( -1 )
50  , avgDuration( 0 )
51  , avgPercent( 0 )
52  {
53  }
54 
55  DtTime startTime; // Time the last section started.
56  DtTime duration; // Duration of the last section.
57  DtTime avgDuration; // Avg duration of section (or sum so far if still processing).
58  double avgPercent; // Avg percent of frame spent in section (or sum so far if still processing).
59  };
60 
62  typedef std::map<FrameSectionType,SectionInfo> SectionInfoMap;
63 
64  public:
65 
70  static DtFrameTimerCreator theFrameTimerCreator;
71 
73  static DtFrameTimer* create( DtPortalConnection* portalConn );
74 
76  virtual ~DtFrameTimer();
77 
79  virtual void markFrameStart();
80 
82  virtual void markFrameEnd();
83 
85  virtual void markStart( FrameSectionType section );
86 
88  virtual void markEnd( FrameSectionType section );
89 
93  virtual void generateReport();
94 
96  virtual void printFrameStatistics();
97 
101  virtual const SectionInfoMap& sectionInfo() const;
102 
106  virtual double fps() const;
107 
108  protected:
109 
111  DtFrameTimer( DtPortalConnection* portalConn );
112 
114  virtual DtString roundPercent( double percent );
115 
116  protected:
117 
119 
120  unsigned int myFrameCounter;
121  unsigned int myLastFrameCount;
123  double myFps;
124 
126 
127  };
128 
129 }

Document ID: Generated on Wed Dec 21 15:05:11 EST 2016 from SVN revision 171891
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)