From 20319660724c678b6fe1c18878222b42b7cbbec2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 7 Jun 2020 07:31:16 -0700 Subject: [PATCH] ircd::server: Add tag completed counters on link and peer w/ report. --- include/ircd/server/link.h | 1 + include/ircd/server/peer.h | 2 ++ ircd/server.cc | 12 ++++++++++++ modules/console.cc | 16 ++++++++-------- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/include/ircd/server/link.h b/include/ircd/server/link.h index 4c7f28bad..5a1fe74e6 100644 --- a/include/ircd/server/link.h +++ b/include/ircd/server/link.h @@ -29,6 +29,7 @@ struct ircd::server::link server::peer *peer; ///< backreference to peer std::shared_ptr socket; ///< link's socket std::list queue; ///< link's work queue + size_t tag_done {0L}; ///< total tags processed time_t synack_ts {0L}; ///< time socket was estab time_t read_ts {0L}; ///< time of last read time_t write_ts {0L}; ///< time of last write diff --git a/include/ircd/server/peer.h b/include/ircd/server/peer.h index 8be544b81..49c7eb8d5 100644 --- a/include/ircd/server/peer.h +++ b/include/ircd/server/peer.h @@ -38,6 +38,7 @@ struct ircd::server::peer std::string server_version; size_t write_bytes {0}; size_t read_bytes {0}; + size_t tag_done {0}; bool op_resolve {false}; bool op_fini {false}; @@ -78,6 +79,7 @@ struct ircd::server::peer size_t link_count() const; size_t link_busy() const; size_t link_ready() const; + size_t link_tag_done() const; // stats for all tags in all links in peer size_t tag_count() const; diff --git a/ircd/server.cc b/ircd/server.cc index 50180bc83..a73123198 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -1121,6 +1121,7 @@ noexcept try if(tag.request) { assert(link.peer); + ++tag_done; log::logf { request::log, uint(tag.state.status) >= 300? log::DERROR: log::DEBUG, @@ -1702,6 +1703,16 @@ const }); } +size_t +ircd::server::peer::link_tag_done() +const +{ + return accumulate_links([](const auto &link) + { + return link.tag_done; + }); +} + size_t ircd::server::peer::link_ready() const @@ -2425,6 +2436,7 @@ try peer->handle_tag_done(*this, tag); assert(!queue.empty()); queue.pop_front(); + ++tag_done; return done; } catch(const buffer_overrun &e) diff --git a/modules/console.cc b/modules/console.cc index 688293637..3a3660f5c 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -5121,13 +5121,13 @@ try out << std::setw(40) << std::right << "NAME" << ' ' << std::setw(40) << std::left << "ADDRESS" << ' ' - << std::setw(23) << std::right << "WRITE-TOTAL" << ' ' << std::setw(23) << std::right << "READ-TOTAL" << ' ' - << std::setw(19) << std::right << "WRITE-PIPE" << ' ' - << std::setw(19) << std::right << "READ-PIPE" << ' ' - << std::setw(4) << std::right << "LNKS" << ' ' + << std::setw(23) << std::right << "WRITE-TOTAL" << ' ' + << std::setw(8) << std::right << "TOTAL" << ' ' + << std::setw(5) << std::right << "DONE" << ' ' << std::setw(4) << std::right << "TAGS" << ' ' << std::setw(4) << std::right << "PIPE" << ' ' + << std::setw(4) << std::right << "LNKS" << ' ' << std::setw(15) << std::left << "FLAGS" << ' ' << std::setw(32) << std::left << "ERROR" << ' ' << std::endl; @@ -5153,13 +5153,13 @@ try out << std::setw(40) << std::right << host << ' ' << std::setw(40) << std::left << net::ipport{peer.remote} << ' ' - << std::setw(23) << std::right << pretty(pbuf, iec(peer.write_total())) << ' ' << std::setw(23) << std::right << pretty(pbuf, iec(peer.read_total())) << ' ' - << std::setw(19) << std::right << pretty(pbuf, iec(peer.write_size())) << ' ' - << std::setw(19) << std::right << pretty(pbuf, iec(peer.read_size())) << ' ' - << std::setw(4) << std::right << peer.link_count() << ' ' + << std::setw(23) << std::right << pretty(pbuf, iec(peer.write_total())) << ' ' + << std::setw(8) << std::right << peer.tag_done << ' ' + << std::setw(5) << std::right << peer.link_tag_done() << ' ' << std::setw(4) << std::right << peer.tag_count() << ' ' << std::setw(4) << std::right << peer.tag_committed() << ' ' + << std::setw(4) << std::right << peer.link_count() << ' ' << std::setw(15) << std::left << flags << ' ' << std::setw(32) << std::left << error << ' ' << std::endl;