VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
profileManager.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
10 
11 #pragma once
12 
13 #include "vrfutil/vrfutilDefines.h"
14 #include "vrfutil/columnLogger.h"
15 
16 #include "vrfutil/profileNode.h"
17 
18 #include <tbb/concurrent_vector.h>
19 #include <tbb/spin_rw_mutex.h>
20 
21 #include <string>
22 #include <map>
23 #include <boost/unordered/unordered_set.hpp>
24 
25 namespace makVrf
26 {
28  typedef unsigned long long DtUInt64;
29 
31  struct DtThreadProfileData;
32  class DtProfileIterator;
33  class DtProfileNode;
34 
38  {
39  public:
40  typedef std::map<std::string, DtColumnLogger*> LoggerMap;
41 
42  static DtProfileManager& Instance();
43 
45 
46  bool enabled() const;
47  void setEnabled(bool);
48 
50  DtProfileTimestamp startProfile(const char* name, DtProfileNode::Attributes);
51  DtProfileTimestamp startProfile(const std::string& name, DtProfileNode::Attributes);
53  void stopProfile(const DtProfileTimestamp&);
54 
56  DtUInt64 getTime();
57 
59  void reset();
62  void incrementFrameCounter();
64  int frameCountSinceReset() {return theFrameCounter; }
66  DtUInt64 timeSinceReset();
67 
69  double averageFps();
71  double instantFps();
72 
74  double instantFrameTime();
75  double averageFrameTime();
76 
78  DtProfileIterator* profileIterator();
79 
81  void releaseIterator(DtProfileIterator* iterator );
82 
83  DtColumnLogger& logger(std::string = std::string());
84 
85  void printLoggers(bool paused, double dT, double simTime, double realTime);
86  void printExtraInfo(const std::string&);
87 
89  {
90  unsigned int id;
91  char* label;
93  };
94 
96  DtThreadProfileData* getCurrentProfileNode(DtProfileNode* = 0);
97 
98  const char* getString(const std::string&);
99 
100  void rollover(const std::string& tag);
101 
102  private:
103  tbb::concurrent_vector<DtThreadProfileData*> theThreadProfileData;
104 
110 
113 
115  std::string myTag;
116 
117  typedef tbb::spin_rw_mutex StringSetMutex;
118  typedef boost::unordered_set<std::string> StringSet;
121 
123  };
124 }
125 
126 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)