Throughput_Stats.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    Throughput_Stats.h
00006  *
00007  *  $Id: Throughput_Stats.h 80826 2008-03-04 14:51:23Z wotte $
00008  *
00009  *  @author David L. Levine
00010  */
00011 //==========================================================================
00012 
00013 
00014 #ifndef ACE_THROUGHPUT_STATS_H
00015 #define ACE_THROUGHPUT_STATS_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include /**/ "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/Basic_Stats.h"
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 /// A simple class to make throughput and latency analysis.
00030 /**
00031  *
00032  * Keep the relevant information to perform throughput and latency
00033  * analysis, including:
00034  * -# Minimum, Average and Maximum latency
00035  * -# Jitter for the latency
00036  * -# Linear regression for throughput
00037  * -# Accumulate results from several samples to obtain aggregated
00038  *    results, across several threads or experiments.
00039  *
00040  * @todo The idea behind this class was to use linear regression to
00041  *       determine if the throughput was linear or exhibited jitter.
00042  *       Unfortunately it never worked quite right, so only average
00043  *       throughput is computed.
00044  */
00045 class ACE_Export ACE_Throughput_Stats : public ACE_Basic_Stats
00046 {
00047 public:
00048   /// Constructor
00049   ACE_Throughput_Stats (void);
00050 
00051   /// Store one sample
00052   void sample (ACE_UINT64 throughput, ACE_UINT64 latency);
00053 
00054   /// Update the values to reflect the stats in @a throughput
00055   void accumulate (const ACE_Throughput_Stats &throughput);
00056 
00057   /// Print down the stats
00058   void dump_results (const ACE_TCHAR* msg, ACE_UINT32 scale_factor);
00059 
00060   /// Dump the average throughput stats.
00061   static void dump_throughput (const ACE_TCHAR *msg,
00062                                ACE_UINT32 scale_factor,
00063                                ACE_UINT64 elapsed_time,
00064                                ACE_UINT32 samples_count);
00065 private:
00066   /// The last throughput measurement.
00067   ACE_UINT64 throughput_last_;
00068 
00069 #if 0
00070   /// These are the fields that we should keep to perform linear
00071   /// regression
00072   //@{
00073   ///@}
00074   ACE_UINT64 throughput_sum_x_;
00075   ACE_UINT64 throughput_sum_x2_;
00076   ACE_UINT64 throughput_sum_y_;
00077   ACE_UINT64 throughput_sum_y2_;
00078   ACE_UINT64 throughput_sum_xy_;
00079 #endif /* 0 */
00080 };
00081 
00082 ACE_END_VERSIONED_NAMESPACE_DECL
00083 
00084 #include /**/ "ace/post.h"
00085 
00086 #endif /* ! ACE_THROUGHPUT_STATS_H */

Generated on Tue Feb 2 17:18:43 2010 for ACE by  doxygen 1.4.7