From: Quentin Young Date: Fri, 18 Sep 2020 19:14:09 +0000 (-0400) Subject: lib: add tracepoint for route table get X-Git-Tag: base_7.6~363^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a72255a336c68dcc62d7bd9fcc1d409ee766cf77;p=mirror%2Ffrr.git lib: add tracepoint for route table get Signed-off-by: Quentin Young --- diff --git a/lib/table.c b/lib/table.c index b315637f19..0d1be2beff 100644 --- a/lib/table.c +++ b/lib/table.c @@ -27,6 +27,7 @@ #include "table.h" #include "memory.h" #include "sockunion.h" +#include "trace.h" DEFINE_MTYPE_STATIC(LIB, ROUTE_TABLE, "Route table") DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node") @@ -276,6 +277,12 @@ struct route_node *route_node_lookup_maynull(struct route_table *table, struct route_node *route_node_get(struct route_table *table, union prefixconstptr pu) { + if (tracepoint_enabled(frr_libfrr, route_node_get)) { + char buf[PREFIX2STR_BUFFER]; + prefix2str(pu, buf, sizeof(buf)); + tracepoint(frr_libfrr, route_node_get, table, buf); + } + struct route_node search; struct prefix *p = &search.p; diff --git a/lib/trace.h b/lib/trace.h index 989361e66c..5e0b13a655 100644 --- a/lib/trace.h +++ b/lib/trace.h @@ -39,6 +39,7 @@ #include "thread.h" #include "memory.h" #include "linklist.h" +#include "table.h" /* clang-format off */ @@ -219,6 +220,18 @@ TRACEPOINT_EVENT( ) ) +TRACEPOINT_EVENT( + frr_libfrr, + route_node_get, + TP_ARGS( + struct route_table *, table, char *, prefix + ), + TP_FIELDS( + ctf_integer_hex(intptr_t, table, table) + ctf_string(prefix, prefix) + ) +) + /* clang-format on */ #include