These are available in ovn-controller logs or when explicitly requested by users with "ovn-appctl -t ovn-controller coverage/show".
Signed-off-by: Dumitru Ceara <[email protected]> --- controller/lflow-cache.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/controller/lflow-cache.c b/controller/lflow-cache.c index 9ebd226..16d1ecd 100644 --- a/controller/lflow-cache.c +++ b/controller/lflow-cache.c @@ -17,10 +17,23 @@ #include <config.h> +#include "coverage.h" #include "lib/ovn-sb-idl.h" #include "lflow-cache.h" #include "ovn/expr.h" +COVERAGE_DEFINE(lflow_cache_flush); +COVERAGE_DEFINE(lflow_cache_add_conj_id); +COVERAGE_DEFINE(lflow_cache_add_expr); +COVERAGE_DEFINE(lflow_cache_add_matches); +COVERAGE_DEFINE(lflow_cache_free_conj_id); +COVERAGE_DEFINE(lflow_cache_free_expr); +COVERAGE_DEFINE(lflow_cache_free_matches); +COVERAGE_DEFINE(lflow_cache_add); +COVERAGE_DEFINE(lflow_cache_hit); +COVERAGE_DEFINE(lflow_cache_miss); +COVERAGE_DEFINE(lflow_cache_delete); + struct lflow_cache { struct hmap entries; bool enabled; @@ -56,6 +69,8 @@ lflow_cache_flush(struct lflow_cache *lc) struct lflow_cache_entry *lce; struct lflow_cache_entry *lce_next; + COVERAGE_INC(lflow_cache_flush); + HMAP_FOR_EACH_SAFE (lce, lce_next, node, &lc->entries) { lflow_cache_delete__(lc, lce); } @@ -96,6 +111,7 @@ lflow_cache_add_conj_id(struct lflow_cache *lc, struct lflow_cache_value *lcv = lflow_cache_add__(lc, lflow, LCACHE_T_CONJ_ID); + COVERAGE_INC(lflow_cache_add_conj_id); lcv->conj_id_ofs = conj_id_ofs; } @@ -108,6 +124,7 @@ lflow_cache_add_expr(struct lflow_cache *lc, struct lflow_cache_value *lcv = lflow_cache_add__(lc, lflow, LCACHE_T_EXPR); + COVERAGE_INC(lflow_cache_add_expr); lcv->conj_id_ofs = conj_id_ofs; lcv->expr = expr; } @@ -120,6 +137,7 @@ lflow_cache_add_matches(struct lflow_cache *lc, struct lflow_cache_value *lcv = lflow_cache_add__(lc, lflow, LCACHE_T_MATCHES); + COVERAGE_INC(lflow_cache_add_matches); lcv->expr_matches = matches; } @@ -135,9 +153,11 @@ lflow_cache_get(struct lflow_cache *lc, const struct sbrec_logical_flow *lflow) HMAP_FOR_EACH_WITH_HASH (lce, node, hash, &lc->entries) { if (uuid_equals(&lce->lflow_uuid, &lflow->header_.uuid)) { + COVERAGE_INC(lflow_cache_hit); return &lce->value; } } + COVERAGE_INC(lflow_cache_miss); return NULL; } @@ -151,6 +171,7 @@ lflow_cache_delete(struct lflow_cache *lc, struct lflow_cache_value *lcv = lflow_cache_get(lc, lflow); if (lcv) { + COVERAGE_INC(lflow_cache_delete); lflow_cache_delete__(lc, CONTAINER_OF(lcv, struct lflow_cache_entry, value)); } @@ -163,6 +184,7 @@ lflow_cache_add__(struct lflow_cache *lc, { struct lflow_cache_entry *lce = xzalloc(sizeof *lce); + COVERAGE_INC(lflow_cache_add); lce->lflow_uuid = lflow->header_.uuid; lce->value.type = type; hmap_insert(&lc->entries, &lce->node, uuid_hash(&lflow->header_.uuid)); @@ -182,11 +204,14 @@ lflow_cache_delete__(struct lflow_cache *lc, struct lflow_cache_entry *lce) OVS_NOT_REACHED(); break; case LCACHE_T_CONJ_ID: + COVERAGE_INC(lflow_cache_free_conj_id); break; case LCACHE_T_EXPR: + COVERAGE_INC(lflow_cache_free_expr); expr_destroy(lce->value.expr); break; case LCACHE_T_MATCHES: + COVERAGE_INC(lflow_cache_free_matches); expr_matches_destroy(lce->value.expr_matches); free(lce->value.expr_matches); break; _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
