VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtInMemoryProfiler.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvUtil/vrvUtil.h>
13 
14 #include <string>
15 #include <fstream>
16 #include <deque>
17 
18 class DtTimedSection;
19 
20 namespace makVrv
21 {
25  {
26  public:
29  static std::size_t calculateNumberOfSamples(float estimatedFrequency, float estimatedRunTimeSeconds);
30 
35  DtInMemoryProfiler(std::size_t numOfSamples, const std::string& fileName);
36 
39 
41  std::size_t numSamples(void) const;
42 
44  void start();
45 
47  void stop();
48 
50  void reset();
51 
54  bool dumped(void) const;
55 
57  void dump();
58 
61  bool valid() const;
62  private:
63  std::string myFileName;
64 
65  const std::size_t myNumSamples;
66  std::size_t myCurrentSample;
67  double* mySamples;
68 
69  bool isValid;
70 
71  DtTimedSection* myTimer;
72 
73  std::ofstream myDumpFile;
74  bool myDumped;
75  };
76 
78  {
79  public:
80  DtInMemoryProfilerHelper(std::size_t numOfSamples, const std::string& fileName);
81 
82  void addProfile(double fStart, double fEndAt);
83  void clearProfiles(void);
84 
85  void profilerPre(double elapsedTime);
86  void profilerPost();
87  private:
89 
90  struct ProfileData
91  {
93  : myStartAt(0), myEndAt(0), myLoggedStart(false), myDumped(false), myID(0) {}
94  double myStartAt;
95  double myEndAt;
97  bool myDumped;
98  std::size_t myID;
99  };
100 
101  typedef std::deque<ProfileData> Profiles;
103 
105  };
106 }
107 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)