My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
Profiler.h
Go to the documentation of this file.
1 // $Id: Profiler.h,v 1.1.1.1 2009/07/06 23:57:26 eml Exp $
2 
3 #ifndef GCP_UTIL_PROFILER_H
4 #define GCP_UTIL_PROFILER_H
5 
16 #include "gcp/util/common/TimeVal.h"
17 
18 #include <iostream>
19 
20 namespace gcp {
21  namespace util {
22 
23  class Profiler {
24  public:
25 
29  Profiler() {};
30 
34  virtual ~Profiler() {};
35 
36  void start() {
37  start_.setToCurrentTime();
38  }
39 
40  void stop() {
41  stop_.setToCurrentTime();
42  }
43 
44  TimeVal& diff() {
45  diff_ = stop_ - start_;
46  return diff_;
47  }
48 
49  private:
50 
51  TimeVal start_, stop_, diff_;
52 
53  }; // End class Profiler
54 
55  } // End namespace util
56 } // End namespace gcp
57 
58 
59 
60 #endif // End #ifndef GCP_UTIL_PROFILER_H
void setToCurrentTime(clockid_t clock=CLOCK_REALTIME)
Definition: TimeVal.cc:710
Profiler()
Definition: Profiler.h:29
virtual ~Profiler()
Definition: Profiler.h:34
Definition: Profiler.h:23