blob: 3be923f7f730f2515d20eedc8037f98d2d207438 (
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
50
51
52
53
|
//$Id$
#include "ace/High_Res_Timer.h"
ACE_INLINE double
Task_Stats::diff_sec (ACE_UINT64 before, ACE_UINT64 after)
{
double seconds =
#if defined ACE_LACKS_LONGLONG_T
(after - before) / gsf_;
#else /* ! ACE_LACKS_LONGLONG_T */
static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER((after - before) / gsf_));
#endif /* ! ACE_LACKS_LONGLONG_T */
seconds /= ACE_HR_SCALE_CONVERSION;
return seconds;
}
ACE_INLINE ACE_UINT32
Task_Stats::diff_usec (ACE_UINT64 before, ACE_UINT64 after)
{
// convert to microseconds
#if !defined ACE_LACKS_LONGLONG_T
ACE_UINT32 elapsed_microseconds = ACE_UINT32((after - before) / gsf_);
#else /* ! ACE_LACKS_LONGLONG_T */
ACE_UINT32 elapsed_microseconds = (after - before) / gsf_;
#endif /* ! ACE_LACKS_LONGLONG_T */
#if defined (ACE_WIN32)
elapsed_microseconds*=1000; // convert to uSec on Win32
#endif /* ACE_WIN32 */
return elapsed_microseconds;
}
ACE_INLINE int
Task_Stats::sample (ACE_UINT64 inv_start_time, ACE_UINT64 inv_end_time)
{
if (this->samples_count_ >= this->max_samples_)
{
ACE_DEBUG ((LM_DEBUG, "Task_Stats::sample ret -1\n"));
return -1;
}
this->time_inv_[this->samples_count_] = inv_start_time;
this->time_exec_[this->samples_count_] = inv_end_time;
this->samples_count_++;
return 0;
}
|