git-svn-id: svn://db.shs.com.ru/pip@402 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-19 13:25:02 +00:00
parent 2bd6c71cb6
commit d1a33a841d
6 changed files with 140 additions and 100 deletions

View File

@@ -105,14 +105,21 @@ void PIDiagnostics::tick(void * , int ) {
float itr = disconn_ * (float(tcnt_recv) / history_rec.size());
float its = disconn_ * (float(tcnt_send) / history_send.size());
float hz = interval() / 1000.f;
if (tcnt_recv == 0) integral_freq = 0;
// piCoutObj << itr << tcnt_recv << history_rec.size();
else integral_freq = recv.cnt_ok / itr;
packets_recv_sec = ullong(float(recv.cnt_ok) / itr);
packets_send_sec = ullong(float(send.cnt_ok) / its);
bytes_recv_sec = ullong(double(recv.bytes_ok) / itr);
bytes_send_sec = ullong(double(send.bytes_ok) / its);
immediate_freq = double(history_rec.front().cnt_ok) / hz;
if (tcnt_recv == 0) {
integral_freq = immediate_freq = 0;
packets_recv_sec = bytes_recv_sec = 0;
} else {
integral_freq = recv.cnt_ok / itr;
packets_recv_sec = ullong(float(recv.cnt_ok) / itr);
bytes_recv_sec = ullong(double(recv.bytes_ok) / itr);
immediate_freq = double(history_rec.front().cnt_ok) / hz;
}
if (tcnt_send == 0) {
packets_send_sec = bytes_send_sec = 0;
} else {
packets_send_sec = ullong(float(send.cnt_ok) / its);
bytes_send_sec = ullong(double(send.bytes_ok) / its);
}
// piCoutObj << "tick" << recv.cnt_ok << send.cnt_ok;
// speedRecv = PIString::readableSize(ullong(double(history_rec.front().bytes_ok) / hz)) + "/s";
// speedSend = PIString::readableSize(ullong(double(history_send.front().bytes_ok) / hz)) + "/s";
@@ -174,7 +181,7 @@ void PIDiagnostics::changeDisconnectTimeout(float disct) {
lock();
disconn_ = piMaxf(disct, interval() / 1000.f);
if (interval() > 0) {
int hist_size = piMaxi(int(disconn_ * 1000. / interval()), 1);
int hist_size = piClampi(int(disconn_ * 1000.f / float(interval())), 1, 65536);
//piCoutObj << hist_size << interval();
history_rec.resize(hist_size);
history_send.resize(hist_size);