diff options
author | Kevin Traynor <ktraynor@redhat.com> | 2023-01-24 09:59:33 +0000 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-01-27 16:57:27 +0100 |
commit | 3beff0a6b09e183f46249b94865b56ea7c4c0350 (patch) | |
tree | 25860760d34569a8e1d295c66d319c42fc9305a3 /lib | |
parent | 7db18054ffee964b5a32c5f88e7dd3a0ee60b82e (diff) | |
download | openvswitch-3beff0a6b09e183f46249b94865b56ea7c4c0350.tar.gz |
dpif-netdev-perf: Add metric averages when no iterations.
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
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpif-netdev-perf.c | 49 |
1 files 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 @@ -337,29 +337,32 @@ pmd_perf_format_histograms(struct ds *str, struct pmd_perf_stats *s) ">", s->max_vhost_qfill.bin[i], ">", 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); } void |