VR-Forces 4.2 Class Documentation
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 
21 class DtScopeTimer : boost::noncopyable
22 {
23 public:
27  DtScopeTimer(const std::string& text, std::ostream& str = DtWarn)
28  : myStream(str)
29  , myText(text)
30  , myStart(tbb::tick_count::now())
31  {
32  }
33 
34  std::string& text()
35  {
36  return myText;
37  }
38 
40  {
41  double d = (tbb::tick_count::now() - myStart).seconds();
42  myStream << myText << " took " << d << " seconds" << std::endl;
43  }
44 
45 private:
46  std::ostream& myStream;
47  std::string myText;
48  tbb::tick_count myStart;
49 };

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)