@@ -475,19 +475,27 @@ void start_statistic_thread(std::vector<uint64_t>& totalReqsReceived,
475475 uint64_t total_unmatched_responses_till_now = 0 ;
476476 uint64_t counter = 0 ;
477477
478+ const size_t billion_width = 10 + 6 ;
479+ const size_t million_width = 7 + 2 ;
478480 auto req_name_width = get_req_name_max_size (config_schema);
479- auto resp_name_width = get_resp_name_max_size (config_schema);
481+ auto resp_name_width = get_resp_name_max_size (config_schema) + 1 ;
480482 size_t request_width = 0 ;
481483
482484 auto period_start = std::chrono::steady_clock::now ();
483485 while (true )
484486 {
485487 std::stringstream SStream;
486488 std::this_thread::sleep_for (std::chrono::seconds (1 ));
487- if (counter % 10 == 0 )
488- {
489- SStream << " req-name, resp-name, msg-total, throttled-total, rps, throttled-rps" << std::endl;
490- }
489+ // if (counter % 10 == 0)
490+ // {
491+ SStream << std::endl << std::setw (req_name_width) << " req-name"
492+ << " ," << std::setw (resp_name_width) << " resp-name"
493+ << " ," << std::setw (billion_width) << " msg-total"
494+ << " ," << std::setw (billion_width) << " throttled-total"
495+ << " ," << std::setw (million_width) << " rps"
496+ << " ," << std::setw (billion_width) << " throttled-rps"
497+ << std::endl;
498+ // }
491499 counter++;
492500
493501 auto resp_sent_till_last = resp_sent_till_now;
@@ -549,31 +557,31 @@ void start_statistic_thread(std::vector<uint64_t>& totalReqsReceived,
549557 {
550558 SStream << std::setw (req_name_width) << config_schema.service [req_index].request .name
551559 << " ," << std::setw (resp_name_width) << config_schema.service [req_index].responses [resp_index].name
552- << " ," << std::setw (req_name_width ) << resp_sent_till_now[req_index][resp_index]
553- << " ," << std::setw (req_name_width ) << resp_throttled_till_now[req_index][resp_index]
554- << " ," << std::setw (req_name_width ) << ((resp_sent_till_now[req_index][resp_index] -
560+ << " ," << std::setw (billion_width ) << resp_sent_till_now[req_index][resp_index]
561+ << " ," << std::setw (billion_width ) << resp_throttled_till_now[req_index][resp_index]
562+ << " ," << std::setw (million_width ) << ((resp_sent_till_now[req_index][resp_index] -
555563 resp_sent_till_last[req_index][resp_index])*std::milli::den) / period_duration
556- << " ," << std::setw (req_name_width ) << ((resp_throttled_till_now[req_index][resp_index] -
564+ << " ," << std::setw (billion_width ) << ((resp_throttled_till_now[req_index][resp_index] -
557565 resp_throttled_till_last[req_index][resp_index])*std::milli::den) / period_duration
558566 << std::endl;
559567 }
560568 }
561569 SStream << std::setw (req_name_width) << " SUM"
562570 << " ," << std::setw (resp_name_width) << " SUM"
563- << " ," << std::setw (req_name_width ) << total_resp_sent_till_now
564- << " ," << std::setw (req_name_width ) << total_resp_throttled_till_now
565- << " ," << std::setw (req_name_width ) << ((total_resp_sent_till_now - total_resp_sent_till_last)*std::milli::den) /
571+ << " ," << std::setw (billion_width ) << total_resp_sent_till_now
572+ << " ," << std::setw (billion_width ) << total_resp_throttled_till_now
573+ << " ," << std::setw (million_width ) << ((total_resp_sent_till_now - total_resp_sent_till_last)*std::milli::den) /
566574 period_duration
567- << " ," << std::setw (req_name_width ) << ((total_resp_throttled_till_now - total_resp_throttled_till_last)
575+ << " ," << std::setw (billion_width ) << ((total_resp_throttled_till_now - total_resp_throttled_till_last)
568576 *std::milli::den) / period_duration
569577 << std::endl;
570578
571579 SStream << std::setw (req_name_width) << " UNMATCHED"
572580 << " ," << std::setw (resp_name_width) << " ---"
573- << " ," << std::setw (req_name_width ) << total_unmatched_responses_till_now
574- << " ," << std::setw (req_name_width ) << " ---"
575- << " ," << std::setw (req_name_width ) << ((total_unmatched_responses_till_now - total_unmatched_responses_till_last)*std::milli::den) / period_duration
576- << " ," << std::setw (req_name_width ) << " ---"
581+ << " ," << std::setw (billion_width ) << total_unmatched_responses_till_now
582+ << " ," << std::setw (billion_width ) << " ---"
583+ << " ," << std::setw (million_width ) << ((total_unmatched_responses_till_now - total_unmatched_responses_till_last)*std::milli::den) / period_duration
584+ << " ," << std::setw (billion_width ) << " ---"
577585 << std::endl;
578586 if (config_schema.statistics_file .empty ())
579587 {
@@ -644,6 +652,7 @@ void start_server(const std::string& config_file_name, bool start_stats_thread,
644652 }
645653 if (start_stats_thread)
646654 {
655+ std::cerr << " start_statistic_thread" << std::endl;
647656 start_statistic_thread (totalReqsReceived, respStats, totalUnMatchedResponses, config_schema);
648657 }
649658
0 commit comments