From: Willy Tarreau Date: Sat, 24 Nov 2012 13:06:49 +0000 (+0100) Subject: MINOR: stats: also report the computed compression savings in html stats X-Git-Tag: v1.5-dev14~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f149d8f21e65333b4639215b9fb9556b596a80cf;p=thirdparty%2Fhaproxy.git MINOR: stats: also report the computed compression savings in html stats It's interesting to know the average compression ratio obtained on frontends and backends without having to compute it by hand, so let's report it in the HTML stats. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index 7c9365b827..ec27db8da8 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -2488,8 +2488,10 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc U2H7(px->fe_counters.bytes_in)); /* compression stats (via td title): comp_in, comp_out, comp_byp */ - chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld\"", - px->fe_counters.comp_in, px->fe_counters.comp_out, px->fe_counters.comp_byp); + chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld savings=%d%%\"", + px->fe_counters.comp_in, px->fe_counters.comp_out, px->fe_counters.comp_byp, + px->fe_counters.comp_in ? + (int)((px->fe_counters.comp_in - px->fe_counters.comp_out)*100/px->fe_counters.comp_in) : 0); chunk_appendf(&trash, /* bytes: out */ @@ -3214,8 +3216,10 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc U2H8(px->be_counters.bytes_in)); /* compression stats (via td title): comp_in, comp_out, comp_byp */ - chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld\"", - px->be_counters.comp_in, px->be_counters.comp_out, px->be_counters.comp_byp); + chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld savings=%d%%\"", + px->be_counters.comp_in, px->be_counters.comp_out, px->be_counters.comp_byp, + px->be_counters.comp_in ? + (int)((px->be_counters.comp_in - px->be_counters.comp_out)*100/px->be_counters.comp_in) : 0); chunk_appendf(&trash, /* bytes: out */