Shiokaze Framework
A research-oriented fluid solver for computer graphics
scoped_timer.h
Go to the documentation of this file.
1 /*
2 ** scoped_timer.h
3 **
4 ** This is part of Shiokaze, a research-oriented fluid solver for computer graphics.
5 ** Created by Ryoichi Ando <rand@nii.ac.jp> on March 15, 2018.
6 **
7 ** Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ** this software and associated documentation files (the "Software"), to deal in
9 ** the Software without restriction, including without limitation the rights to use,
10 ** copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11 ** Software, and to permit persons to whom the Software is furnished to do so,
12 ** subject to the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included in all copies
15 ** or substantial portions of the Software.
16 **
17 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 ** CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 //
25 #ifndef SHKZ_SCOPE_TIMER_H
26 #define SHKZ_SCOPE_TIMER_H
27 //
28 #include <string>
29 #include <stack>
30 #include <shiokaze/core/credit.h>
31 //
33 //
35 class scoped_timer {
38 public:
47  scoped_timer( std::string master_name="", std::string secondary_name="" );
56  scoped_timer( const credit *cr, std::string secondary_name="" );
61  virtual ~scoped_timer();
66  void tick();
75  double tock( std::string subname="" );
84  std::string stock( std::string subname="" );
85  //
86 private:
87  //
88  std::stack<double> m_time_stack;
89  std::string m_master_name;
90  int m_pause_counter;
91  //
92 };
93 //
95 //
96 #endif
scoped_timer
Timer designed to calculate the timings within scope.
Definition: scoped_timer.h:37
credit.h
scoped_timer::~scoped_timer
virtual ~scoped_timer()
Default destructor for scoped_timer.
scoped_timer::stock
std::string stock(std::string subname="")
Stop recording time and return time string.
SHKZ_BEGIN_NAMESPACE
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
scoped_timer::scoped_timer
scoped_timer(std::string master_name="", std::string secondary_name="")
Cnstructor.
scoped_timer::tick
void tick()
Start recording time.
credit
Class that defines the name, argument name, author's name, email address, date and the version of the...
Definition: credit.h:47
SHKZ_END_NAMESPACE
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
scoped_timer::tock
double tock(std::string subname="")
Stop recording time.