pmd-perf-show with pmd-perf-metrics=true displays a histogram
with averages. However, averages were not displayed when there
is no iterations.

They will be all zero so it is not hiding useful information
but the stats look incomplete without them, especially when
they are displayed for some PMD thread cores and not others.

The histogram print is large and this is just an extra couple
of lines, so might as well print them all the time to ensure
that the user does not think there is something missing from
the display.

Before patch:
Histograms
   cycles/it
   499       0
   716       0
   1025      0
   1469      0
<snip>

After patch:
Histograms
   cycles/it
   499       0
   716       0
   1025      0
   1469      0
<snip>
---------------
   cycles/it
   0

Signed-off-by: Kevin Traynor <ktray...@redhat.com>
---
 lib/dpif-netdev-perf.c | 49 ++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/lib/dpif-netdev-perf.c b/lib/dpif-netdev-perf.c
index a552948ac..79ea5e3be 100644
--- a/lib/dpif-netdev-perf.c
+++ b/lib/dpif-netdev-perf.c
@@ -338,27 +338,30 @@ pmd_perf_format_histograms(struct ds *str, struct 
pmd_perf_stats *s)
                   ">", s->upcalls.bin[i],
                   ">", s->cycles_per_upcall.bin[i]);
-    if (s->totals.iterations > 0) {
-        ds_put_cstr(str,
-                    "-----------------------------------------------------"
-                    "-----------------------------------------------------"
-                    "------------------------------------------------\n");
-        ds_put_format(str,
-                      "   %-21s  %-21s  %-21s  %-21s  %-21s  %-21s  %-21s\n",
-                      "cycles/it", "packets/it", "cycles/pkt", "pkts/batch",
-                      "vhost qlen", "upcalls/it", "cycles/upcall");
-        ds_put_format(str,
-                      "   %-21"PRIu64"  %-21.5f  %-21"PRIu64
-                      "  %-21.5f  %-21.5f  %-21.5f  %-21"PRIu32"\n",
-                      s->totals.cycles / s->totals.iterations,
-                      1.0 * s->totals.pkts / s->totals.iterations,
-                      s->totals.pkts
-                          ? s->totals.busy_cycles / s->totals.pkts : 0,
-                      s->totals.batches
-                          ? 1.0 * s->totals.pkts / s->totals.batches : 0,
-                      1.0 * s->totals.max_vhost_qfill / s->totals.iterations,
-                      1.0 * s->totals.upcalls / s->totals.iterations,
-                      s->totals.upcalls
-                          ? s->totals.upcall_cycles / s->totals.upcalls : 0);
-    }
+    ds_put_cstr(str,
+                "-----------------------------------------------------"
+                "-----------------------------------------------------"
+                "------------------------------------------------\n");
+    ds_put_format(str,
+                  "   %-21s  %-21s  %-21s  %-21s  %-21s  %-21s  %-21s\n",
+                  "cycles/it", "packets/it", "cycles/pkt", "pkts/batch",
+                  "vhost qlen", "upcalls/it", "cycles/upcall");
+    ds_put_format(str,
+                  "   %-21"PRIu64"  %-21.5f  %-21"PRIu64
+                  "  %-21.5f  %-21.5f  %-21.5f  %-21"PRIu32"\n",
+                  s->totals.iterations
+                      ? s->totals.cycles / s->totals.iterations : 0,
+                  s->totals.iterations
+                      ? 1.0 * s->totals.pkts / s->totals.iterations : 0,
+                  s->totals.pkts
+                      ? s->totals.busy_cycles / s->totals.pkts : 0,
+                  s->totals.batches
+                      ? 1.0 * s->totals.pkts / s->totals.batches : 0,
+                  s->totals.iterations
+                      ? 1.0 * s->totals.max_vhost_qfill / s->totals.iterations
+                      : 0,
+                  s->totals.iterations
+                      ? 1.0 * s->totals.upcalls / s->totals.iterations : 0,
+                  s->totals.upcalls
+                      ? s->totals.upcall_cycles / s->totals.upcalls : 0);
 }
 
-- 
2.39.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to