00001 // $Id: Basic_Stats.inl,v 1.1.1.1 2001/12/04 14:32:59 chad Exp $ 00002 00003 ACE_INLINE 00004 ACE_Basic_Stats::ACE_Basic_Stats (void) 00005 : samples_count_ (0) 00006 , min_ (0) 00007 , min_at_ (0) 00008 , max_ (0) 00009 , max_at_ (0) 00010 , sum_ (0) 00011 , sum2_ (0) 00012 { 00013 } 00014 00015 ACE_INLINE ACE_UINT32 00016 ACE_Basic_Stats::samples_count (void) const 00017 { 00018 return this->samples_count_; 00019 } 00020 00021 ACE_INLINE void 00022 ACE_Basic_Stats::sample (ACE_UINT64 value) 00023 { 00024 ++this->samples_count_; 00025 00026 if (this->samples_count_ == 1u) 00027 { 00028 this->min_ = value; 00029 this->min_at_ = this->samples_count_; 00030 this->max_ = value; 00031 this->max_at_ = this->samples_count_; 00032 this->sum_ = value; 00033 #if defined ACE_LACKS_LONGLONG_T 00034 this->sum2_ = value * ACE_U64_TO_U32 (value); 00035 #else /* ! ACE_LACKS_LONGLONG_T */ 00036 this->sum2_ = value * value; 00037 #endif /* ! ACE_LACKS_LONGLONG_T */ 00038 } 00039 else 00040 { 00041 if (this->min_ > value) 00042 { 00043 this->min_ = value; 00044 this->min_at_ = this->samples_count_; 00045 } 00046 if (this->max_ < value) 00047 { 00048 this->max_ = value; 00049 this->max_at_ = this->samples_count_; 00050 } 00051 00052 this->sum_ += value; 00053 #if defined ACE_LACKS_LONGLONG_T 00054 this->sum2_ += value * ACE_U64_TO_U32 (value); 00055 #else /* ! ACE_LACKS_LONGLONG_T */ 00056 this->sum2_ += value * value; 00057 #endif /* ! ACE_LACKS_LONGLONG_T */ 00058 } 00059 }
1.2.14 written by Dimitri van Heesch,
© 1997-2002