[master] 0efdb5c Remove arbitrary 1.0 threshold in varnishtop -1

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon May 28 11:08:10 UTC 2018


commit 0efdb5c85bcb60020ea0c538b7d1909034c42dab
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue May 22 13:39:38 2018 +0200

    Remove arbitrary 1.0 threshold in varnishtop -1
    
    With that both -d and -1 options report the same output, with the former
    limited to the terminal height. While this increases the risk of "never
    ending" dumps of log records showing only once, the assumption is that
    varnishtop is useful when someone is looking for something in particular.
    Restricting the output to the records someone is interested in mitigates
    the risk.
    
    Fixes #2686

diff --git a/bin/varnishtest/tests/r02686.vtc b/bin/varnishtest/tests/r02686.vtc
new file mode 100644
index 0000000..53d1aa1
--- /dev/null
+++ b/bin/varnishtest/tests/r02686.vtc
@@ -0,0 +1,27 @@
+varnishtest "varnishtop -1/-d"
+
+server s1 {
+        rxreq
+        txresp
+} -start
+
+varnish v1 -vcl+backend { } -start
+
+client c1 {
+        txreq
+        rxresp
+} -run
+
+process p1 -dump {varnishtop -n ${v1_name} -d -i ReqMethod} -start
+process p1 -winsz 30 80
+delay 2
+process p1 -expect-text 1  1 "list length 1"
+process p1 -expect-text 1 75 "(EOF)"
+process p1 -expect-text 3  6 "1.00 ReqMethod      GET"
+process p1 -screen_dump -wait
+
+process p2 -dump {varnishtop -n ${v1_name} -1 -i ReqMethod} -start
+process p2 -winsz 30 80
+delay 2
+process p2 -expect-text 1 6 "1.00 ReqMethod GET"
+process p2 -screen_dump -wait
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 3035487..8bdb065 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -322,8 +322,6 @@ dump(void)
 	struct top *tp, *tp2;
 	for (tp = VRB_MIN(t_order, &h_order); tp != NULL; tp = tp2) {
 		tp2 = VRB_NEXT(t_order, &h_order, tp);
-		if (tp->count <= 1.0)
-			break;
 		printf("%9.2f %s %*.*s\n",
 			tp->count, VSL_tags[tp->tag],
 			tp->clen, tp->clen, tp->rec_data);


More information about the varnish-commit mailing list