diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
commit | 99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch) | |
tree | bda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/ace/Sample_History.cpp | |
parent | c4078c377d74290ebe4e66da0b4975da91732376 (diff) | |
download | ATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz |
undoing accidental deletion
Diffstat (limited to 'ACE/ace/Sample_History.cpp')
-rw-r--r-- | ACE/ace/Sample_History.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/ACE/ace/Sample_History.cpp b/ACE/ace/Sample_History.cpp new file mode 100644 index 00000000000..9bd2ca47852 --- /dev/null +++ b/ACE/ace/Sample_History.cpp @@ -0,0 +1,73 @@ +// $Id$ + +#include "ace/Sample_History.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Sample_History.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Basic_Stats.h" +#include "ace/Log_Msg.h" +#include "ace/OS_Memory.h" + +ACE_RCSID(ace, Sample_History, "$Id$") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Sample_History::ACE_Sample_History (size_t max_samples) + : max_samples_ (max_samples) + , sample_count_ (0) +{ + ACE_NEW(this->samples_, ACE_UINT64[this->max_samples_]); +} + +ACE_Sample_History::~ACE_Sample_History (void) +{ + delete[] this->samples_; +} + +size_t +ACE_Sample_History::max_samples (void) const +{ + return this->max_samples_; +} + +size_t +ACE_Sample_History::sample_count (void) const +{ + return this->sample_count_; +} + +void +ACE_Sample_History::dump_samples (const ACE_TCHAR *msg, + ACE_UINT32 scale_factor) const +{ +#ifndef ACE_NLOGGING + for (size_t i = 0; i != this->sample_count_; ++i) + { + const ACE_UINT64 val = this->samples_[i] / scale_factor; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s: ") + ACE_SIZE_T_FORMAT_SPECIFIER + ACE_TEXT ("\t%Q\n"), + msg, + i, + val)); + } +#else + ACE_UNUSED_ARG (msg); + ACE_UNUSED_ARG (scale_factor); +#endif /* ACE_NLOGGING */ +} + +void +ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const +{ + for (size_t i = 0; i != this->sample_count_; ++i) + { + stats.sample (this->samples_[i]); + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL |