These are available in ovn-controller logs or when explicitly requested by users with "ovn-appctl -t ovn-controller coverage/show".
Acked-by: Mark Michelson <mmich...@redhat.com> Acked-by: Numan Siddique <num...@ovn.org> Signed-off-by: Dumitru Ceara <dce...@redhat.com> --- controller/lflow-cache.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/controller/lflow-cache.c b/controller/lflow-cache.c index 185f540..be764d5 100644 --- a/controller/lflow-cache.c +++ b/controller/lflow-cache.c @@ -17,10 +17,23 @@ #include <config.h> +#include "coverage.h" #include "lflow-cache.h" #include "lib/uuid.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); + static const char *lflow_cache_type_names[LCACHE_T_MAX] = { [LCACHE_T_CONJ_ID] = "cache-conj-id", [LCACHE_T_EXPR] = "cache-expr", @@ -65,6 +78,7 @@ lflow_cache_flush(struct lflow_cache *lc) return; } + COVERAGE_INC(lflow_cache_flush); for (size_t i = 0; i < LCACHE_T_MAX; i++) { struct lflow_cache_entry *lce; struct lflow_cache_entry *lce_next; @@ -139,6 +153,7 @@ lflow_cache_add_conj_id(struct lflow_cache *lc, const struct uuid *lflow_uuid, if (!lcv) { return; } + COVERAGE_INC(lflow_cache_add_conj_id); lcv->conj_id_ofs = conj_id_ofs; } @@ -153,6 +168,7 @@ lflow_cache_add_expr(struct lflow_cache *lc, const struct uuid *lflow_uuid, expr_destroy(expr); return; } + COVERAGE_INC(lflow_cache_add_expr); lcv->conj_id_ofs = conj_id_ofs; lcv->expr = expr; } @@ -169,6 +185,7 @@ lflow_cache_add_matches(struct lflow_cache *lc, const struct uuid *lflow_uuid, free(matches); return; } + COVERAGE_INC(lflow_cache_add_matches); lcv->expr_matches = matches; } @@ -186,10 +203,12 @@ lflow_cache_get(struct lflow_cache *lc, const struct uuid *lflow_uuid) HMAP_FOR_EACH_WITH_HASH (lce, node, hash, &lc->entries[i]) { if (uuid_equals(&lce->lflow_uuid, lflow_uuid)) { + COVERAGE_INC(lflow_cache_hit); return &lce->value; } } } + COVERAGE_INC(lflow_cache_miss); return NULL; } @@ -202,6 +221,7 @@ lflow_cache_delete(struct lflow_cache *lc, const struct uuid *lflow_uuid) struct lflow_cache_value *lcv = lflow_cache_get(lc, lflow_uuid); if (lcv) { + COVERAGE_INC(lflow_cache_delete); lflow_cache_delete__(lc, CONTAINER_OF(lcv, struct lflow_cache_entry, value)); } @@ -217,6 +237,7 @@ lflow_cache_add__(struct lflow_cache *lc, const struct uuid *lflow_uuid, struct lflow_cache_entry *lce = xzalloc(sizeof *lce); + COVERAGE_INC(lflow_cache_add); lce->lflow_uuid = *lflow_uuid; lce->value.type = type; hmap_insert(&lc->entries[type], &lce->node, uuid_hash(lflow_uuid)); @@ -236,11 +257,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 d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev