]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: also report the computed compression savings in html stats
authorWilly Tarreau <w@1wt.eu>
Sat, 24 Nov 2012 13:06:49 +0000 (14:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 24 Nov 2012 13:06:49 +0000 (14:06 +0100)
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.

src/dumpstats.c

index 7c9365b8274f3acfbfe5bb356775204e0f2df09d..ec27db8da82ddc731db29d9bbdf14ac2c038636e 100644 (file)
@@ -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 */