Commit f4a62a2f authored by Pavel Vainerman's avatar Pavel Vainerman

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

parent 606ceab8
......@@ -23,7 +23,8 @@ noQueryOptimization(false),
force_disconnect(false),
allNotRespond(false),
prefix(prefix),
no_extimer(false)
no_extimer(false),
poll_count(0)
{
// cout << "$ $" << endl;
......@@ -47,9 +48,9 @@ no_extimer(false)
dlog[Debug::INFO] << myname << "(init): read fileter-field='" << s_field
<< "' filter-value='" << s_fvalue << "'" << endl;
//задаем тестовое время (если нет, то оно равно 0)
test_time = 0;
test_time = conf->getArgInt("--" + prefix + "-statistic-sec");
stat_time = conf->getArgPInt("--" + prefix + "-statistic-sec",it.getProp("statistic_sec"),0);
if( stat_time > 0 )
ptStatistic.setTiming(stat_time*1000);
// ---------- init MBTCP ----------
string pname("--" + prefix + "-gateway-iaddr");
......@@ -306,18 +307,16 @@ void MBTCPMaster::poll()
break;
}
if( test_time==0 )
continue;
if( stat_time > 0 )
{
poll_count++;
if(poll_count==0)
pt = PassiveTimer();
if(pt.getCurrent()>=test_time*1000)
if( ptStatistic.checkTime() )
{
cout << endl << "numbr of calls is " << poll_count << endl << endl;
pt.reset();
cout << endl << "(poll statistic): number of calls is " << poll_count << " (poll time: " << stat_time << " sec)" << endl << endl;
ptStatistic.reset();
poll_count=0;
}
}
// mb->disconnect();
}
......
......@@ -378,9 +378,9 @@ class MBTCPMaster:
bool no_extimer;
timeout_t test_time; /*! При тестировании это время, за которое мы веведем в консоль кол-во посланных запросов MBTCPMaster-ом */
timeout_t stat_time; /*!< время сбора статистики обмена */
int poll_count;
PassiveTimer pt;
PassiveTimer ptStatistic; /*!< таймер для сбора статистики обмена */
};
// -----------------------------------------------------------------------------
#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