PIP  0.4.0_beta2
Platform-Independent Primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PIDiagnostics Class Reference

Connection quality diagnostics. More...

+ Inheritance diagram for PIDiagnostics:

Public Types

enum  Quality {
  Unknown = 1, Failure = 2, Bad = 3, Average = 4,
  Good = 5
}
 Connection quality. More...
 

Public Member Functions

 PIDiagnostics (bool start_=true)
 Constructs an empty diagnostics and if "strat_" start it.
 
float immediateFrequency () const
 Returns immediate receive frequency, packets/s.
 
float integralFrequency () const
 Returns integral receive frequency for period, packets/s.
 
ullong receiveCountPerSec () const
 Returns correct received packets per second.
 
ullong sendCountPerSec () const
 Returns sended packets per second.
 
ullong receiveBytesPerSec () const
 Returns correct received bytes per second.
 
ullong sendBytesPerSec () const
 Returns sended bytes per second.
 
ullong receiveCount () const
 Returns overall correct received packets count.
 
ullong wrongCount () const
 Returns overall wrong received packets count.
 
ullong sendCount () const
 Returns overall sended packets count.
 
PIDiagnostics::Quality quality () const
 Returns connection quality.
 
PIString receiveSpeed () const
 Returns receive speed in format "n {B|kB|MB|GB|TB}/s".
 
PIString sendSpeed () const
 Returns send speed in format "n {B|kB|MB|GB|TB}/s".
 
const float * immediateFrequency_ptr () const
 Returns immediate receive frequency pointer, packets/s. Useful for output to PIConsole.
 
const float * integralFrequency_ptr () const
 Returns integral receive frequency pointer for period, packets/s. Useful for output to PIConsole.
 
const ullong * receiveCountPerSec_ptr () const
 Returns correct received packets per second pointer. Useful for output to PIConsole.
 
const ullong * sendCountPerSec_ptr () const
 Returns sended packets per second pointer. Useful for output to PIConsole.
 
const ullong * receiveBytesPerSec_ptr () const
 Returns correct received bytes per second pointer. Useful for output to PIConsole.
 
const ullong * sendBytesPerSec_ptr () const
 Returns sended bytes per second pointer. Useful for output to PIConsole.
 
const ullong * receiveCount_ptr () const
 Returns overall correct received packets count pointer. Useful for output to PIConsole.
 
const ullong * wrongCount_ptr () const
 Returns overall wrong received packets count pointer. Useful for output to PIConsole.
 
const ullong * sendCount_ptr () const
 Returns overall sended packets count pointer. Useful for output to PIConsole.
 
const int * quality_ptr () const
 Returns connection quality pointer. Useful for output to PIConsole.
 
const PIStringreceiveSpeed_ptr () const
 Returns receive speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole.
 
const PIStringsendSpeed_ptr () const
 Returns send speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole.
 

Handlers

void start (double msecs)
 Start diagnostics evaluations with period "msecs" milliseconds.
 
void reset ()
 Reset diagnostics counters.
 
void received (int size, bool correct)
 Notify diagnostics about "correct" corected received packet.
 
void sended (int size)
 Notify diagnostics about sended packet.
 

Events

void qualityChanged (PIDiagnostics::Quality new_quality, PIDiagnostics::Quality old_quality)
 Raise on change receive quality from "old_quality" to "new_quality".
 

Additional Inherited Members

Detailed Description

Connection quality diagnostics.

Synopsis

This class provide abstract connection quality diagnostics and counting. You should create instance of PIDiagnostics and on packet receive call function received(), on packet send call function 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 start() or pass true to constructor.

Member Enumeration Documentation

Connection quality.

Enumerator
Unknown 

Unknown, no one packet received yet

Failure 

No connection, no one correct packet received for last period

Bad 

Bad connection, correct packets received <= 20%

Average 

Average connection, correct packets received > 20% and <= 80%

Good 

Good connection, correct packets received > 80%