00001 // -*- C++ -*- 00002 // 00003 // Basic_Stats.inl,v 4.4 2005/10/28 16:14:51 ossama Exp 00004 00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 ACE_Basic_Stats::ACE_Basic_Stats (void) 00009 : samples_count_ (0) 00010 , min_ (0) 00011 , min_at_ (0) 00012 , max_ (0) 00013 , max_at_ (0) 00014 , sum_ (0) 00015 { 00016 } 00017 00018 ACE_INLINE ACE_UINT32 00019 ACE_Basic_Stats::samples_count (void) const 00020 { 00021 return this->samples_count_; 00022 } 00023 00024 ACE_INLINE void 00025 ACE_Basic_Stats::sample (ACE_UINT64 value) 00026 { 00027 ++this->samples_count_; 00028 00029 if (this->samples_count_ == 1u) 00030 { 00031 this->min_ = value; 00032 this->min_at_ = this->samples_count_; 00033 this->max_ = value; 00034 this->max_at_ = this->samples_count_; 00035 } 00036 else 00037 { 00038 if (this->min_ > value) 00039 { 00040 this->min_ = value; 00041 this->min_at_ = this->samples_count_; 00042 } 00043 if (this->max_ < value) 00044 { 00045 this->max_ = value; 00046 this->max_at_ = this->samples_count_; 00047 } 00048 } 00049 00050 this->sum_ += value; 00051 } 00052 00053 ACE_END_VERSIONED_NAMESPACE_DECL