blob: 05707c373992f771992331bf73e800eb6752c301 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "Profile_Code.h"
#include "ace/Time_Value.h"
Profile_Code::Profile_Code (const std::string& file)
:running_(false)
{
// open the file ...
this->file_.open (file.c_str (), std::ios::app);
}
Profile_Code::~Profile_Code ()
{
this->file_.close ();
}
void Profile_Code::start ()
{
// if still running ... stop it and then run again ...
if (this->running_)
{
this->timer_.stop ();
}
// start the timer ....
this->timer_.start ();
this->running_ = true;
}
void Profile_Code::stop ()
{
this->timer_.stop ();
this->timer_.elapsed_microseconds (this->elapsed_time_);
// reset the state
this->running_ = false;
}
void
Profile_Code::dump ()
{
this->file_ << this->elapsed_time_ << std::endl;
}
|