VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 };

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)