feisty meow concerns codebase 2.140
throughput_counter.h
Go to the documentation of this file.
1#ifndef THROUGHPUT_COUNTER_CLASS
2#define THROUGHPUT_COUNTER_CLASS
3
4/*****************************************************************************\
5* *
6* Name : throughput_counter *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2000-$now By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
18#include <timely/time_stamp.h>
19
20namespace sockets {
21
23
29{
30public:
34
36
37 void start();
39
43 void stop();
45
48 void reset();
50
51 void combine(const throughput_counter &to_blend);
53
60 void send(double size_of_send);
62
65 void add_run(double size_of_send, double time_of_send,
66 double number_of_runs = 1.0);
68
72 bool running() const { return _running; }
74
77
81
82 double bytes_sent() const { return _byte_count; }
84
87 double number_of_sends() const { return _send_count; }
89
90 double bytes_per_second() const;
92 double kilobytes_per_second() const;
94 double megabytes_per_second() const;
96
97 double total_time() const;
99
101private:
102 bool _running;
103 timely::time_stamp *_start;
104 timely::time_stamp *_end;
105 double _time_overall;
106 double _byte_count;
107 double _send_count;
108};
109
110} //namespace.
111
112#endif
113
Reports on average bandwidth of the transfers being measured.
double kilobytes_per_second() const
returns the number of kilobytes that transfers are getting per second.
double bytes_sent() const
returns the number of bytes sent so far.
void reset()
clears all statistics and starts over.
void stop()
ends the current run.
double total_time() const
the run time so far, in milliseconds.
bool running() const
returns whether a test run is being worked on or not.
double number_of_sends() const
returns the number of sends that have occurred.
void send(double size_of_send)
records a sending of "size_of_send" bytes.
throughput_counter & operator=(const throughput_counter &to_copy)
double bytes_per_second() const
returns the number of bytes that transfers are getting per second.
timely::time_stamp stop_time() const
reports the time when this run was stopped.
timely::time_stamp start_time() const
reports the time when this run started.
double megabytes_per_second() const
returns the number of megabytes that transfers are getting per second.
void start()
begins timing a run.
void combine(const throughput_counter &to_blend)
incorporates the statistics from "to_blend" into this counter.
void add_run(double size_of_send, double time_of_send, double number_of_runs=1.0)
records a run without changing the state of the current run.
Represents a point in time relative to the operating system startup time.
Definition time_stamp.h:38
Provides access to the operating system's socket methods.