30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
@@ -20,6 +20,23 @@
|
||||
#include "pidiagnostics.h"
|
||||
|
||||
|
||||
/** \class PIDiagnostics
|
||||
* \brief Connection quality diagnostics
|
||||
* \details
|
||||
* \section PIDiagnostics_sec0 Synopsis
|
||||
* This class provide abstract connection quality diagnostics and
|
||||
* counting. You should create instance of %PIDiagnostics and on
|
||||
* packet receive call function \a received(), on packet send call
|
||||
* function \a sended(). %PIDiagnostics calculates correct, wrong
|
||||
* and sended counters, packets per second, bytes per seconds,
|
||||
* immediate and integral receive frequencies and receive/send speeds
|
||||
* in human readable representation. There statistics are calculates
|
||||
* one time per period, by default 1 second. To calculate them you
|
||||
* should start %PIDiagnostics with function \a start() or pass \b true
|
||||
* to constructor.
|
||||
* */
|
||||
|
||||
|
||||
PIDiagnostics::PIDiagnostics(bool start_): PITimer() {
|
||||
PITimer::reset();
|
||||
reset();
|
||||
@@ -46,9 +63,9 @@ void PIDiagnostics::received(int size, bool correct) {
|
||||
rec_once = 1;
|
||||
if (correct) {
|
||||
float el = elapsed_s();
|
||||
PITimer::reset();
|
||||
if (el > 0.f) immediate_freq = ifreq = 1.f / el;
|
||||
else immediate_freq = ifreq = 0.f;
|
||||
PITimer::reset();
|
||||
receive_count++;
|
||||
packets_in_sec++;
|
||||
bytes_in_sec += size;
|
||||
|
||||
Reference in New Issue
Block a user