From: Gaetan Rivet <[email protected]> Count the number of updates done (insertion + deletion) to each caches.
Signed-off-by: Gaetan Rivet <[email protected]> Acked-by: Roi Dayan <[email protected]> --- lib/dpif-netdev-perf.h | 3 +++ lib/dpif-netdev.c | 10 ++++++++++ utilities/checkpatch.py | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netdev-perf.h b/lib/dpif-netdev-perf.h index 84beced1519e..cb0639e6eef6 100644 --- a/lib/dpif-netdev-perf.h +++ b/lib/dpif-netdev-perf.h @@ -71,6 +71,9 @@ enum pmd_stat_type { PMD_STAT_MASKED_LOOKUP, /* Number of subtable lookups for flow table hits. Each MASKED_HIT hit will have >= 1 MASKED_LOOKUP(s). */ + PMD_STAT_SIMPLE_UPDATE, /* Updates on the simple match cache. */ + PMD_STAT_EXACT_UPDATE, /* Updates on the exact match cache (EMC). */ + PMD_STAT_SMC_UPDATE, /* Updates on the sig match cache (SMC). */ PMD_STAT_RECV, /* Packets entering the datapath pipeline from an * interface. */ PMD_STAT_RECIRC, /* Packets reentering the datapath pipeline due to diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 2a529f272d16..b4d7afd7e282 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3485,6 +3485,7 @@ emc_probabilistic_insert(struct dp_netdev_pmd_thread *pmd, if (min && random_uint32() <= min) { emc_insert(&(pmd->flow_cache).emc_cache, key, flow); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_UPDATE, 1); } } @@ -3543,6 +3544,9 @@ smc_insert(struct dp_netdev_pmd_thread *pmd, for (i = 0; i < SMC_ENTRY_PER_BUCKET; i++) { if (bucket->sig[i] == sig) { bucket->flow_idx[i] = index; + /* Count 1 delete + 1 add. */ + pmd_perf_update_counter(&pmd->perf_stats, + PMD_STAT_SMC_UPDATE, 2); return; } } @@ -3551,6 +3555,8 @@ smc_insert(struct dp_netdev_pmd_thread *pmd, if (bucket->flow_idx[i] == UINT16_MAX) { bucket->sig[i] = sig; bucket->flow_idx[i] = index; + pmd_perf_update_counter(&pmd->perf_stats, + PMD_STAT_SMC_UPDATE, 1); return; } } @@ -3558,6 +3564,8 @@ smc_insert(struct dp_netdev_pmd_thread *pmd, i = random_uint32() % SMC_ENTRY_PER_BUCKET; bucket->sig[i] = sig; bucket->flow_idx[i] = index; + pmd_perf_update_counter(&pmd->perf_stats, + PMD_STAT_SMC_UPDATE, 1); } inline void @@ -4065,6 +4073,7 @@ dp_netdev_simple_match_insert(struct dp_netdev_pmd_thread *pmd, CONST_CAST(struct cmap_node *, &dp_flow->simple_match_node), hash); ccmap_inc(&pmd->n_simple_flows, odp_to_u32(in_port)); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SIMPLE_UPDATE, 1); VLOG_DBG("Simple match insert: " "core_id(%d),in_port(%"PRIu32"),mark(0x%016"PRIx64").", @@ -4095,6 +4104,7 @@ dp_netdev_simple_match_remove(struct dp_netdev_pmd_thread *pmd, CONST_CAST(struct cmap_node *, &flow->simple_match_node), hash); ccmap_dec(&pmd->n_simple_flows, odp_to_u32(in_port)); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SIMPLE_UPDATE, 1); dp_netdev_flow_unref(flow); } } diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index fe6aa79b0d2d..b8ded0b12dea 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -115,7 +115,7 @@ def open_spell_check_dict(): 'tftp', 'timeval', 'trie', 'tso', 'ubsan', 'ukey', 'umask', 'unassociated', 'unixctl', 'uuid' 'virtqueue', 'vms', 'vnet', 'vport', 'vports', - 'vtep', 'wc', 'wget', 'xenserver'] + 'vtep', 'wc', 'wget', 'xenserver', 'sig'] global spell_check_dict -- 2.47.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
