VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
performanceMonitor.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 #if 0
8 
11 
12 #include "vrfutil/vrfutilDefines.h"
13 
14 #include <string>
15 #include <map>
16 
17 #include <tbb/spin_mutex.h>
18 
19 #ifdef WIN32
20 #include <BaseTsd.h>
21 #endif
22 
23 class DT_DLL_vrfutil DtPerformanceMonitor
24 {
25 public:
26 #ifdef WIN32
27  typedef ULONG64 TimeStamp;
29  typedef ULONG64 Duration;
30 #else
31  typedef int TimeStamp;
33  typedef int Duration;
34 #endif
35 
37  {
38  public:
39  static Context& Root();
40 
41  Context& operator[](std::string text);
42 
43  void add(Duration time);
44 
45  protected:
46  typedef tbb::spin_mutex Mutex;
47  mutable Mutex myMutex;
48 
49  typedef std::map<std::string, Context> Map;
50  Map myMap;
51  };
52 
53  explicit DtPerformanceMonitor(Context&);
54  explicit DtPerformanceMonitor(const std::string& label, Context* = 0);
55 
56  ~DtPerformanceMonitor();
57 
58 
59  void stop();
60 
61 protected:
62  Context& myContext;
63  TimeStamp myStartTime;
64 };
65 
66 #define DtPERFORMANCE_CONTEXT(text) \
67  static DtPerformanceMonitor::Context& thePerfContext \
68  = DtPerformanceMonitor::Context::Root()[text]; \
69  DtPerformanceMonitor performanceMonitor(thePerfContext);
70 
71 #endif
Definition: vrfObjectManipulationHandlerBaseClass.h:47
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)