From 069d404cfe3b0d51d1b49edf57cdb3cec180afee Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 29 May 2012 14:21:36 +0200 Subject: [PATCH] frontend_net: report min, max, average response times --- src/filter_frontend_net.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/filter_frontend_net.cpp b/src/filter_frontend_net.cpp index 57fab7a..b9526c5 100644 --- a/src/filter_frontend_net.cpp +++ b/src/filter_frontend_net.cpp @@ -61,6 +61,9 @@ namespace metaproxy_1 { ZAssocServer **az; int m_duration_freq[22]; double m_duration_lim[22]; + double m_duration_max; + double m_duration_min; + double m_duration_total; public: Rep(); ~Rep(); @@ -183,7 +186,15 @@ void yf::FrontendNet::ThreadPoolPackage::result(const char *t_info) while (m_p->m_duration_lim[ent] != 0.0 && duration > m_p->m_duration_lim[ent]) ent++; m_p->m_duration_freq[ent]++; - + + m_p->m_duration_total += duration; + + if (m_p->m_duration_max < duration) + m_p->m_duration_max = duration; + + if (m_p->m_duration_min == 0.0 || m_p->m_duration_min > duration) + m_p->m_duration_min = duration; + if (m_p->m_msg_config.length()) { Z_GDU *z_gdu = gdu->get(); @@ -298,16 +309,30 @@ void yf::FrontendNet::ZAssocChild::report(Z_HTTP_Request *hreq) { if (m_p->m_duration_freq[i] > 0) wrbuf_printf( - w, " \n", + w, " \n", i > 0 ? m_p->m_duration_lim[i - 1] : 0.0, m_p->m_duration_lim[i], m_p->m_duration_freq[i]); } if (m_p->m_duration_freq[i] > 0) wrbuf_printf( - w, " \n", + w, " \n", m_p->m_duration_lim[i - 1], m_p->m_duration_freq[i]); + + if (m_p->m_duration_max != 0.0) + wrbuf_printf( + w, " \n", + m_p->m_duration_max); + if (m_p->m_duration_min != 0.0) + wrbuf_printf( + w, " \n", + m_p->m_duration_min); + if (m_p->m_duration_total != 0.0) + wrbuf_printf( + w, " \n", + m_p->m_duration_total / number_total); + wrbuf_puts(w, " \n"); wrbuf_puts(w, "\n"); @@ -482,7 +507,10 @@ yf::FrontendNet::Rep::Rep() m_duration_lim[18] = 15.0; m_duration_lim[19] = 20.0; m_duration_lim[20] = 30.0; - m_duration_lim[21] = 0; + m_duration_lim[21] = 0.0; + m_duration_max = 0.0; + m_duration_min = 0.0; + m_duration_total = 0.0; } yf::FrontendNet::Rep::~Rep() -- 1.7.10.4