00001 #ifndef THROUGHPUT_COUNTER_CLASS
00002 #define THROUGHPUT_COUNTER_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mechanisms_dll.h"
00019
00020
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