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.
This commit is contained in:
Willy Tarreau 2012-11-24 14:06:49 +01:00
parent 9b6700f673
commit f149d8f21e
1 changed files with 8 additions and 4 deletions

View File

@ -2488,8 +2488,10 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc
U2H7(px->fe_counters.bytes_in)); U2H7(px->fe_counters.bytes_in));
/* compression stats (via td title): comp_in, comp_out, comp_byp */ /* compression stats (via td title): comp_in, comp_out, comp_byp */
chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld\"", 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, 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, chunk_appendf(&trash,
/* bytes: out */ /* 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)); U2H8(px->be_counters.bytes_in));
/* compression stats (via td title): comp_in, comp_out, comp_byp */ /* compression stats (via td title): comp_in, comp_out, comp_byp */
chunk_appendf(&trash, " title=\"compression: in=%lld out=%lld bypassed=%lld\"", 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, 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, chunk_appendf(&trash,
/* bytes: out */ /* bytes: out */