1 // $Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/Basic_Stats.h"
4 #include "ace/Log_Msg.h"
6 #if !defined (__ACE_INLINE__)
7 #include "ace/Basic_Stats.inl"
8 #endif /* __ACE_INLINE__ */
12 "$Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $")
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
17 ACE_Basic_Stats::accumulate (const ACE_Basic_Stats
&rhs
)
19 if (rhs
.samples_count_
== 0)
22 if (this->samples_count_
== 0)
24 this->min_
= rhs
.min_
;
25 this->min_at_
= rhs
.min_at_
;
27 this->max_
= rhs
.max_
;
28 this->max_at_
= rhs
.max_at_
;
32 if (this->min_
> rhs
.min_
)
34 this->min_
= rhs
.min_
;
35 this->min_at_
= rhs
.min_at_
;
37 if (this->max_
< rhs
.max_
)
39 this->max_
= rhs
.max_
;
40 this->max_at_
= rhs
.max_at_
;
44 this->samples_count_
+= rhs
.samples_count_
;
45 this->sum_
+= rhs
.sum_
;
49 ACE_Basic_Stats::dump_results (const ACE_TCHAR
*msg
, ACE_UINT32 sf
) const
52 if (this->samples_count () == 0u)
55 ACE_TEXT ("%s : no data collected\n"), msg
));
59 ACE_UINT64 avg
= this->sum_
/ this->samples_count_
;
61 ACE_UINT64 l_min
= this->min_
/ sf
;
62 ACE_UINT64 l_max
= this->max_
/ sf
;
63 ACE_UINT64 l_avg
= avg
/ sf
;
66 ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"),
70 l_max
, this->max_at_
));
75 #endif /* ACE_NLOGGING */
78 ACE_END_VERSIONED_NAMESPACE_DECL