1 #include "ace/Basic_Stats.h"
2 #include "ace/Log_Category.h"
4 #if !defined (__ACE_INLINE__)
5 #include "ace/Basic_Stats.inl"
6 #endif /* __ACE_INLINE__ */
8 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ACE_Basic_Stats::accumulate (const ACE_Basic_Stats
&rhs
)
13 if (rhs
.samples_count_
== 0)
16 if (this->samples_count_
== 0)
18 this->min_
= rhs
.min_
;
19 this->min_at_
= rhs
.min_at_
;
21 this->max_
= rhs
.max_
;
22 this->max_at_
= rhs
.max_at_
;
26 if (this->min_
> rhs
.min_
)
28 this->min_
= rhs
.min_
;
29 this->min_at_
= rhs
.min_at_
;
31 if (this->max_
< rhs
.max_
)
33 this->max_
= rhs
.max_
;
34 this->max_at_
= rhs
.max_at_
;
38 this->samples_count_
+= rhs
.samples_count_
;
39 this->sum_
+= rhs
.sum_
;
43 ACE_Basic_Stats::dump_results (
45 ACE_Basic_Stats::scale_factor_type sf
) const
48 if (this->samples_count () == 0u)
50 ACELIB_DEBUG ((LM_DEBUG
,
51 ACE_TEXT ("%s : no data collected\n"), msg
));
55 ACE_UINT64 avg
= this->sum_
/ this->samples_count_
;
57 ACE_UINT64 l_min
= this->min_
/ sf
;
58 ACE_UINT64 l_max
= this->max_
/ sf
;
59 ACE_UINT64 l_avg
= avg
/ sf
;
61 ACELIB_DEBUG ((LM_DEBUG
,
62 ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"),
66 l_max
, this->max_at_
));
71 #endif /* ACE_NLOGGING */
74 ACE_END_VERSIONED_NAMESPACE_DECL