diff options
author | zhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-15 23:26:37 +0000 |
---|---|---|
committer | zhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-15 23:26:37 +0000 |
commit | 54191a377b67a851dc03c754a23cb8aaca6b18b2 (patch) | |
tree | 3ecfcb7e0be56c06857e3faf607c85abb2988120 /ACE/ace/Basic_Stats.inl | |
parent | a6b6f9642d622fb9e274ef1e34f3e848ed3ae9dc (diff) | |
download | ATCD-54191a377b67a851dc03c754a23cb8aaca6b18b2.tar.gz |
Creating a branch of ACE+TAO+CIAO for OCI RT 9734
Diffstat (limited to 'ACE/ace/Basic_Stats.inl')
-rw-r--r-- | ACE/ace/Basic_Stats.inl | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ACE/ace/Basic_Stats.inl b/ACE/ace/Basic_Stats.inl new file mode 100644 index 00000000000..bbdce099907 --- /dev/null +++ b/ACE/ace/Basic_Stats.inl @@ -0,0 +1,53 @@ +// -*- C++ -*- +// +// $Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Basic_Stats::ACE_Basic_Stats (void) + : samples_count_ (0) + , min_ (0) + , min_at_ (0) + , max_ (0) + , max_at_ (0) + , sum_ (0) +{ +} + +ACE_INLINE ACE_UINT32 +ACE_Basic_Stats::samples_count (void) const +{ + return this->samples_count_; +} + +ACE_INLINE void +ACE_Basic_Stats::sample (ACE_UINT64 value) +{ + ++this->samples_count_; + + if (this->samples_count_ == 1u) + { + this->min_ = value; + this->min_at_ = this->samples_count_; + this->max_ = value; + this->max_at_ = this->samples_count_; + } + else + { + if (this->min_ > value) + { + this->min_ = value; + this->min_at_ = this->samples_count_; + } + if (this->max_ < value) + { + this->max_ = value; + this->max_at_ = this->samples_count_; + } + } + + this->sum_ += value; +} + +ACE_END_VERSIONED_NAMESPACE_DECL |