VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scopeTimer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #include <tbb/tick_count.h>
11 #include <boost/noncopyable.hpp>
12 #include <vlutil/vlPrint.h>
13 #include <string>
14 
22 class DT_DLL_features DtScopeTimer : boost::noncopyable
23 {
24 public:
28  DtScopeTimer(const std::string& text, std::ostream& str = DtWarn)
29  : myStream(str)
30  , myText(text)
31  , myStart(tbb::tick_count::now())
32  {
33  }
34 
35  std::string& text()
36  {
37  return myText;
38  }
39 
41  {
42  double d = (tbb::tick_count::now() - myStart).seconds();
43  myStream << myText << " took " << d << " seconds" << std::endl;
44  }
45 
46 private:
47  std::ostream& myStream;
48  std::string myText;
49  tbb::tick_count myStart;
50 };
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
~DtScopeTimer()
Definition: scopeTimer.h:40
DtScopeTimer(const std::string &text, std::ostream &str=DtWarn)
Constructor.
Definition: scopeTimer.h:28
This is a simple wrapper around tbb::tick_count timing to be able to easily time a scope of code...
Definition: scopeTimer.h:22
std::string myText
Definition: scopeTimer.h:48
tbb::tick_count myStart
Definition: scopeTimer.h:49
std::ostream & myStream
Definition: scopeTimer.h:47
std::string & text()
Definition: scopeTimer.h:35

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)