git-svn-id: svn://db.shs.com.ru/pip@469 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -46,7 +46,30 @@ public:
|
||||
Average /** Average connection, correct packets received > 20% and <= 80% */ = 4,
|
||||
Good /** Good connection, correct packets received > 80% */ = 5
|
||||
};
|
||||
|
||||
//! Information about current diagnostics state
|
||||
struct State {
|
||||
State();
|
||||
float immediate_freq;
|
||||
float integral_freq;
|
||||
ullong received_packets_per_sec;
|
||||
ullong received_packets;
|
||||
ullong received_packets_wrong;
|
||||
ullong received_bytes_per_sec;
|
||||
ullong received_bytes;
|
||||
ullong received_bytes_wrong;
|
||||
ullong sended_packets_per_sec;
|
||||
ullong sended_packets;
|
||||
ullong sended_bytes_per_sec;
|
||||
ullong sended_bytes;
|
||||
PIString receive_speed;
|
||||
PIString send_speed;
|
||||
PIDiagnostics::Quality quality;
|
||||
};
|
||||
|
||||
|
||||
//! Returns current state
|
||||
PIDiagnostics::State state() const;
|
||||
|
||||
//! Returns period of full disconnect in seconds and period of averaging frequency
|
||||
float disconnectTimeout() const {return disconn_;}
|
||||
@@ -55,95 +78,95 @@ public:
|
||||
void setDisconnectTimeout(float s) {setProperty("disconnectTimeout", s);}
|
||||
|
||||
//! Returns immediate receive frequency, packets/s
|
||||
float immediateFrequency() const {return immediate_freq;}
|
||||
float immediateFrequency() const {return cur_state.immediate_freq;}
|
||||
|
||||
//! Returns integral receive frequency for \a disconnectTimeout() seconds, packets/s
|
||||
float integralFrequency() const {return integral_freq;}
|
||||
float integralFrequency() const {return cur_state.integral_freq;}
|
||||
|
||||
//! Returns correct received packets per second
|
||||
ullong receiveCountPerSec() const {return packets_recv_sec;}
|
||||
ullong receiveCountPerSec() const {return cur_state.received_packets_per_sec;}
|
||||
|
||||
//! Returns sended packets per second
|
||||
ullong sendCountPerSec() const {return packets_send_sec;}
|
||||
ullong sendCountPerSec() const {return cur_state.sended_packets_per_sec;}
|
||||
|
||||
//! Returns correct received bytes per second
|
||||
ullong receiveBytesPerSec() const {return bytes_recv_sec;}
|
||||
ullong receiveBytesPerSec() const {return cur_state.received_bytes_per_sec;}
|
||||
|
||||
//! Returns sended bytes per second
|
||||
ullong sendBytesPerSec() const {return bytes_send_sec;}
|
||||
ullong sendBytesPerSec() const {return cur_state.sended_bytes_per_sec;}
|
||||
|
||||
//! Returns overall correct received bytes
|
||||
ullong receiveBytes() const {return bytes_recv;}
|
||||
ullong receiveBytes() const {return cur_state.received_bytes;}
|
||||
|
||||
//! Returns overall wrong received bytes
|
||||
ullong wrongBytes() const {return bytes_wrong;}
|
||||
ullong wrongBytes() const {return cur_state.received_bytes_wrong;}
|
||||
|
||||
//! Returns overall sended bytes
|
||||
ullong sendBytes() const {return bytes_send;}
|
||||
ullong sendBytes() const {return cur_state.sended_bytes;}
|
||||
|
||||
//! Returns overall correct received packets count
|
||||
ullong receiveCount() const {return count_recv;}
|
||||
ullong receiveCount() const {return cur_state.received_packets;}
|
||||
|
||||
//! Returns overall wrong received packets count
|
||||
ullong wrongCount() const {return count_wrong;}
|
||||
ullong wrongCount() const {return cur_state.received_packets_wrong;}
|
||||
|
||||
//! Returns overall sended packets count
|
||||
ullong sendCount() const {return count_send;}
|
||||
ullong sendCount() const {return cur_state.sended_packets;}
|
||||
|
||||
//! Returns connection quality
|
||||
PIDiagnostics::Quality quality() const {return qual;}
|
||||
PIDiagnostics::Quality quality() const {return cur_state.quality;}
|
||||
|
||||
//! Returns receive speed in format "n {B|kB|MB|GB|TB}/s"
|
||||
PIString receiveSpeed() const {return speedRecv;}
|
||||
PIString receiveSpeed() const;
|
||||
|
||||
//! Returns send speed in format "n {B|kB|MB|GB|TB}/s"
|
||||
PIString sendSpeed() const {return speedSend;}
|
||||
PIString sendSpeed() const;
|
||||
|
||||
|
||||
//! Returns immediate receive frequency pointer, packets/s. Useful for output to PIConsole
|
||||
const float * immediateFrequency_ptr() const {return &immediate_freq;}
|
||||
const float * immediateFrequency_ptr() const {return &cur_state.immediate_freq;}
|
||||
|
||||
//! Returns integral receive frequency pointer for period, packets/s. Useful for output to PIConsole
|
||||
const float * integralFrequency_ptr() const {return &integral_freq;}
|
||||
const float * integralFrequency_ptr() const {return &cur_state.integral_freq;}
|
||||
|
||||
//! Returns correct received packets per second pointer. Useful for output to PIConsole
|
||||
const ullong * receiveCountPerSec_ptr() const {return &packets_recv_sec;}
|
||||
const ullong * receiveCountPerSec_ptr() const {return &cur_state.received_packets_per_sec;}
|
||||
|
||||
//! Returns sended packets per second pointer. Useful for output to PIConsole
|
||||
const ullong * sendCountPerSec_ptr() const {return &packets_send_sec;}
|
||||
const ullong * sendCountPerSec_ptr() const {return &cur_state.sended_packets_per_sec;}
|
||||
|
||||
//! Returns correct received bytes per second pointer. Useful for output to PIConsole
|
||||
const ullong * receiveBytesPerSec_ptr() const {return &bytes_recv_sec;}
|
||||
const ullong * receiveBytesPerSec_ptr() const {return &cur_state.received_bytes_per_sec;}
|
||||
|
||||
//! Returns sended bytes per second pointer. Useful for output to PIConsole
|
||||
const ullong * sendBytesPerSec_ptr() const {return &bytes_send_sec;}
|
||||
const ullong * sendBytesPerSec_ptr() const {return &cur_state.sended_bytes_per_sec;}
|
||||
|
||||
//! Returns overall correct received bytes pointer. Useful for output to PIConsole
|
||||
const ullong * receiveBytes_ptr() const {return &bytes_recv;}
|
||||
const ullong * receiveBytes_ptr() const {return &cur_state.received_bytes;}
|
||||
|
||||
//! Returns overall wrong received bytes pointer. Useful for output to PIConsole
|
||||
const ullong * wrongBytes_ptr() const {return &bytes_wrong;}
|
||||
const ullong * wrongBytes_ptr() const {return &cur_state.received_bytes_wrong;}
|
||||
|
||||
//! Returns overall sended bytes pointer. Useful for output to PIConsole
|
||||
const ullong * sendBytes_ptr() const {return &bytes_send;}
|
||||
const ullong * sendBytes_ptr() const {return &cur_state.sended_bytes;}
|
||||
|
||||
//! Returns overall correct received packets count pointer. Useful for output to PIConsole
|
||||
const ullong * receiveCount_ptr() const {return &count_recv;}
|
||||
const ullong * receiveCount_ptr() const {return &cur_state.received_packets;}
|
||||
|
||||
//! Returns overall wrong received packets count pointer. Useful for output to PIConsole
|
||||
const ullong * wrongCount_ptr() const {return &count_wrong;}
|
||||
const ullong * wrongCount_ptr() const {return &cur_state.received_packets_wrong;}
|
||||
|
||||
//! Returns overall sended packets count pointer. Useful for output to PIConsole
|
||||
const ullong * sendCount_ptr() const {return &count_send;}
|
||||
const ullong * sendCount_ptr() const {return &cur_state.sended_packets;}
|
||||
|
||||
//! Returns connection quality pointer. Useful for output to PIConsole
|
||||
const int * quality_ptr() const {return (int * )&qual;}
|
||||
const int * quality_ptr() const {return (int * )&cur_state.quality;}
|
||||
|
||||
//! Returns receive speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole
|
||||
const PIString * receiveSpeed_ptr() const {return &speedRecv;}
|
||||
const PIString * receiveSpeed_ptr() const {return &cur_state.receive_speed;}
|
||||
|
||||
//! Returns send speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole
|
||||
const PIString * sendSpeed_ptr() const {return &speedSend;}
|
||||
const PIString * sendSpeed_ptr() const {return &cur_state.send_speed;}
|
||||
|
||||
EVENT_HANDLER0(void, start) {start(100.); changeDisconnectTimeout(disconn_);}
|
||||
EVENT_HANDLER1(void, start, double, msecs) {if (msecs > 0.) {PITimer::start(msecs); changeDisconnectTimeout(disconn_);}}
|
||||
@@ -194,14 +217,12 @@ private:
|
||||
Entry calcHistory(PIQueue<Entry> & hist, int & cnt);
|
||||
void propertyChanged(const PIString &);
|
||||
void changeDisconnectTimeout(float disct);
|
||||
void constLock() const;
|
||||
void constUnlock() const;
|
||||
|
||||
PIDiagnostics::Quality qual;
|
||||
PIString speedRecv, speedSend;
|
||||
float immediate_freq, integral_freq;
|
||||
PIQueue<Entry> history_rec, history_send;
|
||||
float disconn_;
|
||||
ullong count_wrong, count_recv, count_send, bytes_wrong, bytes_recv, bytes_send;
|
||||
ullong packets_recv_sec, packets_send_sec, bytes_recv_sec, bytes_send_sec;
|
||||
State cur_state;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user