feisty meow concerns codebase  2.140
sockets::throughput_counter Class Reference

Reports on average bandwidth of the transfers being measured. More...

#include <throughput_counter.h>

Public Member Functions

 throughput_counter ()
 
 throughput_counter (const throughput_counter &to_copy)
 
 ~throughput_counter ()
 
throughput_counteroperator= (const throughput_counter &to_copy)
 
void start ()
 begins timing a run. More...
 
void stop ()
 ends the current run. More...
 
void reset ()
 clears all statistics and starts over. More...
 
void combine (const throughput_counter &to_blend)
 incorporates the statistics from "to_blend" into this counter. More...
 
void send (double size_of_send)
 records a sending of "size_of_send" bytes. More...
 
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. More...
 
bool running () const
 returns whether a test run is being worked on or not. More...
 
timely::time_stamp start_time () const
 reports the time when this run started. More...
 
timely::time_stamp stop_time () const
 reports the time when this run was stopped. More...
 
double bytes_sent () const
 returns the number of bytes sent so far. More...
 
double number_of_sends () const
 returns the number of sends that have occurred. More...
 
double bytes_per_second () const
 returns the number of bytes that transfers are getting per second. More...
 
double kilobytes_per_second () const
 returns the number of kilobytes that transfers are getting per second. More...
 
double megabytes_per_second () const
 returns the number of megabytes that transfers are getting per second. More...
 
double total_time () const
 the run time so far, in milliseconds. More...
 

Detailed Description

Reports on average bandwidth of the transfers being measured.

Tracks the amount of data sent over a period of time and provides statistics about the transfer rate.

Definition at line 28 of file throughput_counter.h.

Constructor & Destructor Documentation

◆ throughput_counter() [1/2]

sockets::throughput_counter::throughput_counter ( )

Definition at line 27 of file throughput_counter.cpp.

◆ throughput_counter() [2/2]

sockets::throughput_counter::throughput_counter ( const throughput_counter to_copy)

Definition at line 36 of file throughput_counter.cpp.

◆ ~throughput_counter()

sockets::throughput_counter::~throughput_counter ( )

Definition at line 43 of file throughput_counter.cpp.

References basis::WHACK().

Member Function Documentation

◆ add_run()

void sockets::throughput_counter::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.

this supports adding a timed run to the counter without requiring that start and stop be used. this will work whether a run is currently being timed or not.

Definition at line 104 of file throughput_counter.cpp.

◆ bytes_per_second()

double sockets::throughput_counter::bytes_per_second ( ) const

returns the number of bytes that transfers are getting per second.

Definition at line 122 of file throughput_counter.cpp.

References bytes_sent(), basis::SECOND_ms, and total_time().

Referenced by kilobytes_per_second().

◆ bytes_sent()

double sockets::throughput_counter::bytes_sent ( ) const
inline

returns the number of bytes sent so far.

bytes_sent() and number_of_sends() work at any point during a test run to provide an interim measurement. however after a test run, they report the statistics for the entire history of testing.

Definition at line 82 of file throughput_counter.h.

Referenced by bytes_per_second().

◆ combine()

void sockets::throughput_counter::combine ( const throughput_counter to_blend)

incorporates the statistics from "to_blend" into this counter.

the stats in "to_blend" then no longer need to be considered, since this object records its own plus the blended statistics. note that makes the most sense if both this and "to_blend" are not currently running a simulation, although combining running counters is not prohibited. if either counter is running, those current runs are ignored and only accumulated stats are combined.

Definition at line 63 of file throughput_counter.cpp.

◆ kilobytes_per_second()

double sockets::throughput_counter::kilobytes_per_second ( ) const

returns the number of kilobytes that transfers are getting per second.

Definition at line 128 of file throughput_counter.cpp.

References bytes_per_second(), and basis::KILOBYTE.

Referenced by megabytes_per_second().

◆ megabytes_per_second()

double sockets::throughput_counter::megabytes_per_second ( ) const

returns the number of megabytes that transfers are getting per second.

Definition at line 131 of file throughput_counter.cpp.

References basis::KILOBYTE, and kilobytes_per_second().

◆ number_of_sends()

double sockets::throughput_counter::number_of_sends ( ) const
inline

returns the number of sends that have occurred.

Definition at line 86 of file throughput_counter.h.

◆ operator=()

throughput_counter & sockets::throughput_counter::operator= ( const throughput_counter to_copy)

Definition at line 50 of file throughput_counter.cpp.

◆ reset()

void sockets::throughput_counter::reset ( )

clears all statistics and starts over.

Definition at line 87 of file throughput_counter.cpp.

References timely::time_stamp::reset().

◆ running()

bool sockets::throughput_counter::running ( ) const
inline

returns whether a test run is being worked on or not.

Definition at line 72 of file throughput_counter.h.

Referenced by send(), start(), stop(), and total_time().

◆ send()

void sockets::throughput_counter::send ( double  size_of_send)

records a sending of "size_of_send" bytes.

this should only be called while a test run is being made; the send will be ignored if a run is not occurring.

Definition at line 97 of file throughput_counter.cpp.

References running().

◆ start()

void sockets::throughput_counter::start ( )

begins timing a run.

the current time is recorded and any data sent will be tracked until stop() is invoked. results from previous runs will be merged with the current run.

Definition at line 71 of file throughput_counter.cpp.

References running().

◆ start_time()

time_stamp sockets::throughput_counter::start_time ( ) const

reports the time when this run started.

this and stop_time() report the timing information for the current run, and so are only really relevant when a run is occurring.

Definition at line 112 of file throughput_counter.cpp.

◆ stop()

void sockets::throughput_counter::stop ( )

ends the current run.

the report functions provide information about the speed achieved over this and previous runs.

Definition at line 79 of file throughput_counter.cpp.

References running(), and timely::time_stamp::value().

◆ stop_time()

time_stamp sockets::throughput_counter::stop_time ( ) const

reports the time when this run was stopped.

Definition at line 114 of file throughput_counter.cpp.

◆ total_time()

double sockets::throughput_counter::total_time ( ) const

the run time so far, in milliseconds.

this also counts the time in the current run, if one is occurring.

Definition at line 116 of file throughput_counter.cpp.

References running(), and timely::time_stamp::value().

Referenced by bytes_per_second().


The documentation for this class was generated from the following files: