many changes, need testing
rewrite PIDiagnostics, but not fully testing change PIQueue to PIDeque many fixes in PIBaseTransfer, it will be threadsafe and stable git-svn-id: svn://db.shs.com.ru/pip@187 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
float disconnectTimeout() const {return disconn_;}
|
||||
|
||||
//! Returns period of full disconnect in seconds and period of averaging frequency
|
||||
void setDisconnectTimeout(float s) {setProperty("disconnectTimeout", s); disconn_ = s; changeDisconnectTimeout();}
|
||||
void setDisconnectTimeout(float s) {setProperty("disconnectTimeout", s); changeDisconnectTimeout(s);}
|
||||
|
||||
|
||||
//! Returns immediate receive frequency, packets/s
|
||||
@@ -61,43 +61,43 @@ public:
|
||||
float integralFrequency() const {return integral_freq;}
|
||||
|
||||
//! Returns correct received packets per second
|
||||
ullong receiveCountPerSec() const {return packets_in_sec;}
|
||||
ullong receiveCountPerSec() const {return packets_recv_sec;}
|
||||
|
||||
//! Returns sended packets per second
|
||||
ullong sendCountPerSec() const {return packets_out_sec;}
|
||||
ullong sendCountPerSec() const {return packets_send_sec;}
|
||||
|
||||
//! Returns correct received bytes per second
|
||||
ullong receiveBytesPerSec() const {return bytes_in_sec;}
|
||||
ullong receiveBytesPerSec() const {return bytes_recv_sec;}
|
||||
|
||||
//! Returns sended bytes per second
|
||||
ullong sendBytesPerSec() const {return bytes_out_sec;}
|
||||
ullong sendBytesPerSec() const {return bytes_send_sec;}
|
||||
|
||||
//! Returns overall correct received bytes
|
||||
ullong receiveBytes() const {return receive_bytes;}
|
||||
ullong receiveBytes() const {return bytes_recv;}
|
||||
|
||||
//! Returns overall wrong received bytes
|
||||
ullong wrongBytes() const {return wrong_bytes;}
|
||||
ullong wrongBytes() const {return bytes_wrong;}
|
||||
|
||||
//! Returns overall sended bytes
|
||||
ullong sendBytes() const {return send_bytes;}
|
||||
ullong sendBytes() const {return bytes_send;}
|
||||
|
||||
//! Returns overall correct received packets count
|
||||
ullong receiveCount() const {return receive_count;}
|
||||
ullong receiveCount() const {return count_recv;}
|
||||
|
||||
//! Returns overall wrong received packets count
|
||||
ullong wrongCount() const {return wrong_count;}
|
||||
ullong wrongCount() const {return count_wrong;}
|
||||
|
||||
//! Returns overall sended packets count
|
||||
ullong sendCount() const {return send_count;}
|
||||
ullong sendCount() const {return count_send;}
|
||||
|
||||
//! Returns connection quality
|
||||
PIDiagnostics::Quality quality() const {return qual;}
|
||||
|
||||
//! Returns receive speed in format "n {B|kB|MB|GB|TB}/s"
|
||||
PIString receiveSpeed() const {return speedIn;}
|
||||
PIString receiveSpeed() const {return speedRecv;}
|
||||
|
||||
//! Returns send speed in format "n {B|kB|MB|GB|TB}/s"
|
||||
PIString sendSpeed() const {return speedOut;}
|
||||
PIString sendSpeed() const {return speedSend;}
|
||||
|
||||
|
||||
//! Returns immediate receive frequency pointer, packets/s. Useful for output to PIConsole
|
||||
@@ -107,46 +107,46 @@ public:
|
||||
const float * integralFrequency_ptr() const {return &integral_freq;}
|
||||
|
||||
//! Returns correct received packets per second pointer. Useful for output to PIConsole
|
||||
const ullong * receiveCountPerSec_ptr() const {return &packets_in_sec;}
|
||||
const ullong * receiveCountPerSec_ptr() const {return &packets_recv_sec;}
|
||||
|
||||
//! Returns sended packets per second pointer. Useful for output to PIConsole
|
||||
const ullong * sendCountPerSec_ptr() const {return &packets_out_sec;}
|
||||
const ullong * sendCountPerSec_ptr() const {return &packets_send_sec;}
|
||||
|
||||
//! Returns correct received bytes per second pointer. Useful for output to PIConsole
|
||||
const ullong * receiveBytesPerSec_ptr() const {return &bytes_in_sec;}
|
||||
const ullong * receiveBytesPerSec_ptr() const {return &bytes_recv_sec;}
|
||||
|
||||
//! Returns sended bytes per second pointer. Useful for output to PIConsole
|
||||
const ullong * sendBytesPerSec_ptr() const {return &bytes_out_sec;}
|
||||
const ullong * sendBytesPerSec_ptr() const {return &bytes_send_sec;}
|
||||
|
||||
//! Returns overall correct received bytes pointer. Useful for output to PIConsole
|
||||
const ullong * receiveBytes_ptr() const {return &receive_bytes;}
|
||||
const ullong * receiveBytes_ptr() const {return &bytes_recv;}
|
||||
|
||||
//! Returns overall wrong received bytes pointer. Useful for output to PIConsole
|
||||
const ullong * wrongBytes_ptr() const {return &wrong_bytes;}
|
||||
const ullong * wrongBytes_ptr() const {return &bytes_wrong;}
|
||||
|
||||
//! Returns overall sended bytes pointer. Useful for output to PIConsole
|
||||
const ullong * sendBytes_ptr() const {return &send_bytes;}
|
||||
const ullong * sendBytes_ptr() const {return &bytes_send;}
|
||||
|
||||
//! Returns overall correct received packets count pointer. Useful for output to PIConsole
|
||||
const ullong * receiveCount_ptr() const {return &receive_count;}
|
||||
const ullong * receiveCount_ptr() const {return &count_recv;}
|
||||
|
||||
//! Returns overall wrong received packets count pointer. Useful for output to PIConsole
|
||||
const ullong * wrongCount_ptr() const {return &wrong_count;}
|
||||
const ullong * wrongCount_ptr() const {return &count_wrong;}
|
||||
|
||||
//! Returns overall sended packets count pointer. Useful for output to PIConsole
|
||||
const ullong * sendCount_ptr() const {return &send_count;}
|
||||
const ullong * sendCount_ptr() const {return &count_send;}
|
||||
|
||||
//! Returns connection quality pointer. Useful for output to PIConsole
|
||||
const int * quality_ptr() const {return (int * )&qual;}
|
||||
|
||||
//! Returns receive speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole
|
||||
const PIString * receiveSpeed_ptr() const {return &speedIn;}
|
||||
const PIString * receiveSpeed_ptr() const {return &speedRecv;}
|
||||
|
||||
//! Returns send speed pointer in format "n {B|kB|MB|GB|TB}/s". Useful for output to PIConsole
|
||||
const PIString * sendSpeed_ptr() const {return &speedOut;}
|
||||
const PIString * sendSpeed_ptr() const {return &speedSend;}
|
||||
|
||||
EVENT_HANDLER0(void, start) {start(1000.); changeDisconnectTimeout();}
|
||||
EVENT_HANDLER1(void, start, double, msecs) {if (msecs > 0.) {PITimer::start(msecs); changeDisconnectTimeout();}}
|
||||
EVENT_HANDLER0(void, start) {start(100.); changeDisconnectTimeout(disconn_);}
|
||||
EVENT_HANDLER1(void, start, double, msecs) {if (msecs > 0.) {PITimer::start(msecs); changeDisconnectTimeout(disconn_);}}
|
||||
EVENT_HANDLER0(void, stop) {PITimer::stop();}
|
||||
EVENT_HANDLER0(void, reset);
|
||||
|
||||
@@ -182,27 +182,26 @@ public:
|
||||
|
||||
private:
|
||||
struct Entry {
|
||||
Entry() {ok = true; bytes = 0;}
|
||||
PISystemTime time;
|
||||
bool ok;
|
||||
int bytes;
|
||||
Entry() {bytes_ok = bytes_fail = 0; cnt_ok = cnt_fail = 0; empty = true;}
|
||||
ullong bytes_ok;
|
||||
ullong bytes_fail;
|
||||
uint cnt_ok;
|
||||
uint cnt_fail;
|
||||
bool empty;
|
||||
};
|
||||
|
||||
void tick(void * data, int delimiter);
|
||||
void addToHistory(PIVector<Entry> & hist, int bytes, bool ok = true);
|
||||
void checkHistory(PIVector<Entry> & hist);
|
||||
Entry calcHistory(PIQueue<Entry> & hist, int * cnt);
|
||||
void propertyChanged(const PIString & );
|
||||
void changeDisconnectTimeout();
|
||||
void changeDisconnectTimeout(float disct);
|
||||
|
||||
PIDiagnostics::Quality qual;
|
||||
PIString speedIn, speedOut;
|
||||
float ifreq, immediate_freq, integral_freq, disconn_;
|
||||
PIVector<Entry> history_rec, history_send;
|
||||
PISystemTime disconn_st;
|
||||
PITimeMeasurer tm;
|
||||
char cur_pckt, rec_once;
|
||||
ullong wrong_count, receive_count, send_count, wrong_bytes, receive_bytes, send_bytes;
|
||||
ullong packets_in_sec, packets_out_sec, bytes_in_sec, bytes_out_sec;
|
||||
PIString speedRecv, speedSend;
|
||||
float ifreq, 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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user