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

Sample_History.h

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

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