]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: add tracepoint for hash insertion
authorQuentin Young <qlyoung@nvidia.com>
Wed, 16 Sep 2020 23:29:32 +0000 (19:29 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Fri, 23 Oct 2020 19:13:51 +0000 (15:13 -0400)
hash_get is used for both lookup and insert; add a tracepoint for when
we insert something into the hash

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
lib/hash.c
lib/trace.h

index 99a9e2e3ab887a933b8c44879539de574e0a6284..d0dc639229d08de5be1ecfd27aa7adc2f17ba6a6 100644 (file)
@@ -175,6 +175,8 @@ void *hash_get(struct hash *hash, void *data, void *(*alloc_func)(void *))
                hash->index[index] = bucket;
                hash->count++;
 
+               tracepoint(frr_libfrr, hash_insert, hash, data, key);
+
                int oldlen = bucket->next ? bucket->next->len : 0;
                int newlen = oldlen + 1;
 
index e6d0f115e4aeccd844017e57b6c2f33c9a385e63..753a25f4a575cb9160240ea79eed0861c2f1cf86 100644 (file)
@@ -54,6 +54,21 @@ TRACEPOINT_EVENT(
 
 TRACEPOINT_LOGLEVEL(frr_libfrr, hash_get, TRACE_INFO)
 
+TRACEPOINT_EVENT(
+       frr_libfrr,
+       hash_insert,
+       TP_ARGS(struct hash *, hash, void *, data, unsigned int, key),
+       TP_FIELDS(
+               ctf_string(name, hash->name ? hash->name : "(unnamed)")
+               ctf_integer(unsigned int, key, hash->size)
+               ctf_integer(unsigned int, index_size, hash->size)
+               ctf_integer(unsigned long, item_count, hash->count)
+               ctf_integer_hex(intptr_t, data_ptr, data)
+       )
+)
+
+TRACEPOINT_LOGLEVEL(frr_libfrr, hash_insert, TRACE_INFO)
+
 TRACEPOINT_EVENT(
        frr_libfrr,
        hash_release,