22 using namespace basis;
27 throughput_counter::throughput_counter()
53 if (
this == &to_copy)
return *
this;
54 _running = to_copy._running;
55 *_start = *to_copy._start;
56 *_end = *to_copy._end;
57 _time_overall = to_copy._time_overall;
58 _byte_count = to_copy._byte_count;
59 _send_count = to_copy._send_count;
65 if (
this == &to_blend)
return;
66 _time_overall += to_blend._time_overall;
67 _byte_count += to_blend._byte_count;
68 _send_count += to_blend._send_count;
83 _time_overall += _end->
value() - _start->
value();
101 _byte_count += size_of_send;
105 double number_of_runs)
107 _send_count += number_of_runs;
108 _byte_count += size_of_send;
109 _time_overall += time_of_send;
119 return _time_overall + extra_time;
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.
void send(double size_of_send)
records a sending of "size_of_send" bytes.
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.
void reset()
sets the stamp time back to now.
time_representation value() const
returns the time_stamp in terms of the lower level type.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
const int SECOND_ms
Number of milliseconds in a second.
const int KILOBYTE
Number of bytes in a kilobyte.
Provides access to the operating system's socket methods.