Skip to content

Commit b87d97a

Browse files
committed
Added total counter to Input plugin statistics which sumarize values
over all input plugins
1 parent 64b4c30 commit b87d97a

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

ipfixprobe.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,20 @@ void finish(ipxp_conf_t &conf)
376376

377377
std::cout << "Input stats:" << std::endl <<
378378
std::setw(3) << "#" <<
379-
std::setw(10) << "packets" <<
380-
std::setw(10) << "parsed" <<
381-
std::setw(16) << "bytes" <<
382-
std::setw(10) << "dropped" <<
383-
std::setw(10) << "qtime" <<
379+
std::setw(13) << "packets" <<
380+
std::setw(13) << "parsed" <<
381+
std::setw(20) << "bytes" <<
382+
std::setw(13) << "dropped" <<
383+
std::setw(16) << "qtime" <<
384384
std::setw(7) << "status" << std::endl;
385385

386386
int idx = 0;
387+
uint64_t total_packets = 0;
388+
uint64_t total_parsed = 0;
389+
uint64_t total_bytes = 0;
390+
uint64_t total_dropped = 0;
391+
uint64_t total_qtime = 0;
392+
387393
for (auto &it : conf.input_fut) {
388394
WorkerResult res = it.get();
389395
std::string status = "ok";
@@ -394,13 +400,28 @@ void finish(ipxp_conf_t &conf)
394400
InputStats stats = conf.input_stats[idx]->load();
395401
std::cout <<
396402
std::setw(3) << idx++ << " " <<
397-
std::setw(9) << stats.packets << " " <<
398-
std::setw(9) << stats.parsed << " " <<
399-
std::setw(15) << stats.bytes << " " <<
400-
std::setw(9) << stats.dropped << " " <<
401-
std::setw(9) << stats.qtime << " " <<
403+
std::setw(12) << stats.packets << " " <<
404+
std::setw(12) << stats.parsed << " " <<
405+
std::setw(19) << stats.bytes << " " <<
406+
std::setw(12) << stats.dropped << " " <<
407+
std::setw(15) << stats.qtime << " " <<
402408
std::setw(6) << status << std::endl;
403-
}
409+
total_packets += stats.packets;
410+
total_parsed += stats.parsed;
411+
total_bytes += stats.bytes;
412+
total_dropped += stats.dropped;
413+
total_qtime += stats.qtime;
414+
}
415+
416+
std::cout <<
417+
std::setw(3) << "SUM" <<
418+
std::setw(13) << total_packets <<
419+
std::setw(13) << total_parsed <<
420+
std::setw(20) << total_bytes <<
421+
std::setw(13) << total_dropped <<
422+
std::setw(16) << total_qtime << std::endl;
423+
424+
std::cout << std::endl;
404425

405426
std::cout << "Output stats:" << std::endl <<
406427
std::setw(3) << "#" <<

0 commit comments

Comments
 (0)