diff options
author | Eelco Chaudron <echaudro@redhat.com> | 2021-09-06 10:53:42 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-11-08 21:48:05 +0100 |
commit | efd55eb34cf246d7b65bdae633d9369391dfb5af (patch) | |
tree | 1b2e0438464ece52818f205cf8fd7cd896f44d22 /lib/dpctl.c | |
parent | 317b1bfd7dd315e241c158e6d4095002ff391ee3 (diff) | |
download | openvswitch-efd55eb34cf246d7b65bdae633d9369391dfb5af.tar.gz |
dpctl: dpif: Add kernel datapath cache hit output.
This patch adds cache usage statistics to the output:
$ ovs-dpctl show
system@ovs-system:
lookups: hit:24 missed:71 lost:0
flows: 0
masks: hit:334 total:0 hit/pkt:3.52
cache: hit:4 hit-rate:4.21%
port 0: ovs-system (internal)
port 1: genev_sys_6081 (geneve: packet_type=ptap)
port 2: br-int (internal)
port 3: br-ex (internal)
port 4: eth2
port 5: sw1p1 (internal)
port 6: sw0p4 (internal)
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/dpctl.c')
-rw-r--r-- | lib/dpctl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/dpctl.c b/lib/dpctl.c index ef8ae7402..54a42a403 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -611,6 +611,15 @@ show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p) dpctl_print(dpctl_p, " masks: hit:%"PRIu64" total:%"PRIu32 " hit/pkt:%.2f\n", stats.n_mask_hit, stats.n_masks, avg); + + if (stats.n_cache_hit != UINT64_MAX) { + double avg_hits = n_pkts ? + (double) stats.n_cache_hit / n_pkts * 100 : 0.0; + + dpctl_print(dpctl_p, + " cache: hit:%"PRIu64" hit-rate:%.2f%%\n", + stats.n_cache_hit, avg_hits); + } } } |