Skip to content

Commit 88c6d5e

Browse files
authored
Merge pull request #136 from CESNET/stats-improvements
Input & Output plugins stats improvements
2 parents 64b4c30 + 6fd8bd8 commit 88c6d5e

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

ipfixprobe.cpp

Lines changed: 39 additions & 18 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,20 +400,35 @@ 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;
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;
403414
}
404415

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;
425+
405426
std::cout << "Output stats:" << std::endl <<
406427
std::setw(3) << "#" <<
407-
std::setw(10) << "biflows" <<
408-
std::setw(10) << "packets" <<
409-
std::setw(16) << "bytes" <<
410-
std::setw(10) << "dropped" <<
428+
std::setw(13) << "biflows" <<
429+
std::setw(13) << "packets" <<
430+
std::setw(20) << "bytes (L4)" <<
431+
std::setw(13) << "dropped" <<
411432
std::setw(7) << "status" << std::endl;
412433

413434
idx = 0;
@@ -421,10 +442,10 @@ void finish(ipxp_conf_t &conf)
421442
OutputStats stats = conf.output_stats[idx]->load();
422443
std::cout <<
423444
std::setw(3) << idx++ << " " <<
424-
std::setw(9) << stats.biflows << " " <<
425-
std::setw(9) << stats.packets << " " <<
426-
std::setw(15) << stats.bytes << " " <<
427-
std::setw(9) << stats.dropped << " " <<
445+
std::setw(12) << stats.biflows << " " <<
446+
std::setw(12) << stats.packets << " " <<
447+
std::setw(19) << stats.bytes << " " <<
448+
std::setw(12) << stats.dropped << " " <<
428449
std::setw(6) << status << std::endl;
429450
}
430451

0 commit comments

Comments
 (0)