Commit f4a62a2f authored by Pavel Vainerman's avatar Pavel Vainerman

немного переписал код для ведения статистики обмена

parent 606ceab8
...@@ -23,7 +23,8 @@ noQueryOptimization(false), ...@@ -23,7 +23,8 @@ noQueryOptimization(false),
force_disconnect(false), force_disconnect(false),
allNotRespond(false), allNotRespond(false),
prefix(prefix), prefix(prefix),
no_extimer(false) no_extimer(false),
poll_count(0)
{ {
// cout << "$ $" << endl; // cout << "$ $" << endl;
...@@ -47,9 +48,9 @@ no_extimer(false) ...@@ -47,9 +48,9 @@ no_extimer(false)
dlog[Debug::INFO] << myname << "(init): read fileter-field='" << s_field dlog[Debug::INFO] << myname << "(init): read fileter-field='" << s_field
<< "' filter-value='" << s_fvalue << "'" << endl; << "' filter-value='" << s_fvalue << "'" << endl;
//задаем тестовое время (если нет, то оно равно 0) stat_time = conf->getArgPInt("--" + prefix + "-statistic-sec",it.getProp("statistic_sec"),0);
test_time = 0; if( stat_time > 0 )
test_time = conf->getArgInt("--" + prefix + "-statistic-sec"); ptStatistic.setTiming(stat_time*1000);
// ---------- init MBTCP ---------- // ---------- init MBTCP ----------
string pname("--" + prefix + "-gateway-iaddr"); string pname("--" + prefix + "-gateway-iaddr");
...@@ -306,17 +307,15 @@ void MBTCPMaster::poll() ...@@ -306,17 +307,15 @@ void MBTCPMaster::poll()
break; break;
} }
if( test_time==0 ) if( stat_time > 0 )
continue;
poll_count++;
if(poll_count==0)
pt = PassiveTimer();
if(pt.getCurrent()>=test_time*1000)
{ {
cout << endl << "numbr of calls is " << poll_count << endl << endl; poll_count++;
pt.reset(); if( ptStatistic.checkTime() )
poll_count=0; {
cout << endl << "(poll statistic): number of calls is " << poll_count << " (poll time: " << stat_time << " sec)" << endl << endl;
ptStatistic.reset();
poll_count=0;
}
} }
// mb->disconnect(); // mb->disconnect();
......
...@@ -378,9 +378,9 @@ class MBTCPMaster: ...@@ -378,9 +378,9 @@ class MBTCPMaster:
bool no_extimer; bool no_extimer;
timeout_t test_time; /*! При тестировании это время, за которое мы веведем в консоль кол-во посланных запросов MBTCPMaster-ом */ timeout_t stat_time; /*!< время сбора статистики обмена */
int poll_count; int poll_count;
PassiveTimer pt; PassiveTimer ptStatistic; /*!< таймер для сбора статистики обмена */
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MBTCPMaster_H_ #endif // _MBTCPMaster_H_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment