VR-Exchange 2.9 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
frameTimer.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2013 MAK Technologies, Inc.
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 }
DtPortalConnection * myPortalConn
Definition: frameTimer.h:125
unsigned int myLastFrameCount
Definition: frameTimer.h:121
Definition: frameTimer.h:35
double myFps
Definition: frameTimer.h:123
Stores timing info for a single frame section.
Definition: frameTimer.h:45
SectionInfoMap mySectionInfo
Definition: frameTimer.h:118
DtTime startTime
Definition: frameTimer.h:55
Definition: frameTimer.h:40
FrameSectionType
Enumerates the default frame section types.
Definition: frameTimer.h:31
Definition: frameTimer.h:37
#define DT_DLL_BROKER
Definition: include/broker/dllExport.h:20
Definition: frameTimer.h:33
Definition: frameTimer.h:23
static DtFrameTimerCreator theFrameTimerCreator
Storage for the method used to create the frame timer.
Definition: frameTimer.h:70
DtTime myLastReportTime
Definition: frameTimer.h:122
Definition: frameTimer.h:34
std::map< FrameSectionType, SectionInfo > SectionInfoMap
Definition: frameTimer.h:62
unsigned int myFrameCounter
Definition: frameTimer.h:120
Connects a broker to the Portal Data Exchange.
Definition: pConnection.h:49
double avgPercent
Definition: frameTimer.h:58
DtTime avgDuration
Definition: frameTimer.h:57
DtTime duration
Definition: frameTimer.h:56
SectionInfo()
Definition: frameTimer.h:47

Document ID: Generated on Tue Jun 25 16:45:35 EDT 2024 from SVN revision 267383
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)