A process like ovn-controller can have hundreds of stopwatches.  And
it's possible that half of them have no samples.  Let's just show the
total number of such stopwatches, similarly how it is done for the
coverage counters to reduce the output size.

Signed-off-by: Ilya Maximets <[email protected]>
---
 lib/stopwatch.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/stopwatch.c b/lib/stopwatch.c
index 5655f66f1..5c59fe71c 100644
--- a/lib/stopwatch.c
+++ b/lib/stopwatch.c
@@ -304,10 +304,19 @@ stopwatch_show_protected(int argc, const char *argv[], 
struct ds *s)
         stopwatch_print(sw, argv[1], s);
     } else {
         struct shash_node *node;
+        int no_samples = 0;
+
         SHASH_FOR_EACH (node, &stopwatches) {
             sw = node->data;
+            if (!sw->n_samples) {
+                no_samples++;
+                continue;
+            }
             stopwatch_print(sw, node->name, s);
         }
+        if (no_samples) {
+            ds_put_format(s, "%d stopwatches with no samples\n", no_samples);
+        }
     }
 
     return true;
-- 
2.53.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to