Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Basic_Stats.cpp
blob98e3193f3d8f9d96e816d023b29e1b32d599712f
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
10 void
11 ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
13 if (rhs.samples_count_ == 0)
14 return;
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_;
24 else
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_;
42 void
43 ACE_Basic_Stats::dump_results (
44 const ACE_TCHAR *msg,
45 ACE_Basic_Stats::scale_factor_type sf) const
47 #ifndef ACE_NLOGGING
48 if (this->samples_count () == 0u)
50 ACELIB_DEBUG ((LM_DEBUG,
51 ACE_TEXT ("%s : no data collected\n"), msg));
52 return;
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"),
63 msg,
64 l_min, this->min_at_,
65 l_avg,
66 l_max, this->max_at_));
68 #else
69 ACE_UNUSED_ARG (msg);
70 ACE_UNUSED_ARG (sf);
71 #endif /* ACE_NLOGGING */
74 ACE_END_VERSIONED_NAMESPACE_DECL