throughput_counter.h

Go to the documentation of this file.
00001 #ifndef THROUGHPUT_COUNTER_CLASS
00002 #define THROUGHPUT_COUNTER_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : throughput_counter                                                *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2000-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "mechanisms_dll.h"
00019 
00020 // forward.
00021 class time_stamp;
00022 
00024 
00029 class MECHANISMS_CLASS_STYLE throughput_counter
00030 {
00031 public:
00032   throughput_counter();
00033   throughput_counter(const throughput_counter &to_copy);
00034   ~throughput_counter();
00035 
00036   throughput_counter &operator =(const throughput_counter &to_copy);
00037 
00038   void start();
00040 
00044   void stop();
00046 
00049   void reset();
00051 
00052   void combine(const throughput_counter &to_blend);
00054 
00061   void send(double size_of_send);
00063 
00066   void add_run(double size_of_send, double time_of_send,
00067           double number_of_runs = 1.0);
00069 
00073   inline bool running() const { return _running; }
00075 
00076   time_stamp start_time() const;
00078 
00080   time_stamp stop_time() const;
00082 
00083   inline double bytes_sent() const { return _byte_count; }
00085 
00088   inline double number_of_sends() const { return _send_count; }
00090 
00091   double bytes_per_second() const;
00093   double kilobytes_per_second() const;
00095   double megabytes_per_second() const;
00097 
00098   double total_time() const;
00100 
00102 private:
00103   bool _running;  
00104   time_stamp *_start;  
00105   time_stamp *_end;  
00106   double _time_overall;  
00107   double _byte_count;  
00108   double _send_count;  
00109 };
00110 
00111 #endif
00112 

Generated on Fri Nov 21 04:29:50 2008 for HOOPLE Libraries by  doxygen 1.5.1