Sample_History.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Sample_History.h
00006  *
00007  *  Sample_History.h,v 4.7 2005/10/28 16:14:55 ossama Exp
00008  *
00009  *  @author Carlos O'Ryan <coryan@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_SAMPLE_HISTORY_H
00015 #define ACE_SAMPLE_HISTORY_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 #include "ace/Basic_Types.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00026 
00027 class ACE_Basic_Stats;
00028 
00029 /// Save multiple samples in an array
00030 /**
00031  * Save multiple samples (usually latency numbers), into an array, and
00032  * later print them in several formats.
00033  */
00034 class ACE_Export ACE_Sample_History
00035 {
00036 public:
00037   /// Constructor
00038   /**
00039    * The number of samples is pre-allocated, and cannot changes once
00040    * the class is initialized.
00041    */
00042   ACE_Sample_History (size_t max_samples);
00043 
00044   /// Destructor
00045   ~ACE_Sample_History (void);
00046 
00047   /// Record one sample.
00048   /**
00049    * Return 0 on success, -1 if the sample could not be stored
00050    */
00051   int sample (ACE_UINT64 value);
00052 
00053   /// Returns the maximum number of samples
00054   size_t max_samples (void) const;
00055 
00056   /// Returns the current number of samples
00057   size_t sample_count (void) const;
00058 
00059   /// Dump all the samples
00060   /**
00061    * Prints out all the samples, using @a msg as a prefix for each
00062    * message.
00063    */
00064   void dump_samples (const ACE_TCHAR *msg,
00065                      ACE_UINT32 scale_factor) const;
00066 
00067   /// Collect the summary for all the samples
00068   void collect_basic_stats (ACE_Basic_Stats &) const;
00069 
00070   /// Get a sample
00071   ACE_UINT64 get_sample (size_t i) const;
00072 
00073 private:
00074   /// The maximum number of samples
00075   size_t max_samples_;
00076 
00077   /// The current number of samples
00078   size_t sample_count_;
00079 
00080   /// The samples
00081   ACE_UINT64 *samples_;
00082 };
00083 
00084 ACE_END_VERSIONED_NAMESPACE_DECL
00085 
00086 #if defined (__ACE_INLINE__)
00087 #include "ace/Sample_History.inl"
00088 #endif /* __ACE_INLINE__ */
00089 
00090 #include /**/ "ace/post.h"
00091 #endif /* ACE_SAMPLE_HISTORY_H */

Generated on Thu Nov 9 09:42:02 2006 for ACE by doxygen 1.3.6