Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Sample_History.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 // $Id: Sample_History.cpp,v 1.1.1.2.2.1 2003/03/13 19:44:22 chad Exp $
00003 
00004 #include "ace/Sample_History.h"
00005 #include "ace/Basic_Stats.h"
00006 #include "ace/Log_Msg.h"
00007 #include "ace/OS.h"
00008 
00009 #if !defined (__ACE_INLINE__)
00010 #include "ace/Sample_History.inl"
00011 #endif /* __ACE_INLINE__ */
00012 
00013 ACE_RCSID(ace, Sample_History, "$Id: Sample_History.cpp,v 1.1.1.2.2.1 2003/03/13 19:44:22 chad Exp $")
00014 
00015 ACE_Sample_History::ACE_Sample_History (size_t max_samples)
00016   : max_samples_ (max_samples)
00017   , sample_count_ (0)
00018 {
00019   ACE_NEW(this->samples_, ACE_UINT64[this->max_samples_]);
00020 }
00021 
00022 ACE_Sample_History::~ACE_Sample_History (void)
00023 {
00024   delete[] this->samples_;
00025 }
00026 
00027 size_t
00028 ACE_Sample_History::max_samples (void) const
00029 {
00030   return this->max_samples_;
00031 }
00032 
00033 size_t
00034 ACE_Sample_History::sample_count (void) const
00035 {
00036   return this->sample_count_;
00037 }
00038 
00039 void
00040 ACE_Sample_History::dump_samples (const ACE_TCHAR *msg,
00041                                   ACE_UINT32 scale_factor) const
00042 {
00043   for (size_t i = 0; i != this->sample_count_; ++i)
00044     {
00045       ACE_UINT64 x = this->samples_[i] / scale_factor;
00046       ACE_UINT32 val = ACE_CU64_TO_CU32 (x);
00047       ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("%s: %d %u\n"), msg, i, val));
00048     }
00049 }
00050 
00051 void
00052 ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const
00053 {
00054   for (size_t i = 0; i != this->sample_count_; ++i)
00055     {
00056       stats.sample (this->samples_[i]);
00057     }
00058 }

Generated on Mon Jun 16 11:21:06 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002