diff options
author | Quentin Young <qlyoung@nvidia.com> | 2020-09-15 00:04:33 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@nvidia.com> | 2020-10-23 21:13:51 +0200 |
commit | abf96a87f3f2f9527885ee78930787ecb4068530 (patch) | |
tree | a249c8c015366cfaca7c57fbacf32b04ad055e8e /lib/hash.c | |
parent | lib, configure.ac: initial LTTng support (diff) | |
download | frr-abf96a87f3f2f9527885ee78930787ecb4068530.tar.xz frr-abf96a87f3f2f9527885ee78930787ecb4068530.zip |
lib: add tracepoints for hash ops, thread events
Define some initial tracepoints for hash table operations, thread
schedules, and thread cancels
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Diffstat (limited to 'lib/hash.c')
-rw-r--r-- | lib/hash.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/hash.c b/lib/hash.c index 85982774a..99a9e2e3a 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -29,6 +29,7 @@ #include "command.h" #include "libfrr.h" #include "frr_pthread.h" +#include "trace.h" DEFINE_MTYPE_STATIC(LIB, HASH, "Hash") DEFINE_MTYPE_STATIC(LIB, HASH_BACKET, "Hash Bucket") @@ -138,6 +139,8 @@ static void hash_expand(struct hash *hash) void *hash_get(struct hash *hash, void *data, void *(*alloc_func)(void *)) { + tracepoint(frr_libfrr, hash_get, hash, data); + unsigned int key; unsigned int index; void *newdata; @@ -206,7 +209,7 @@ unsigned int string_hash_make(const char *str) void *hash_release(struct hash *hash, void *data) { - void *ret; + void *ret = NULL; unsigned int key; unsigned int index; struct hash_bucket *bucket; @@ -236,11 +239,14 @@ void *hash_release(struct hash *hash, void *data) ret = bucket->data; XFREE(MTYPE_HASH_BACKET, bucket); hash->count--; - return ret; + break; } pp = bucket; } - return NULL; + + tracepoint(frr_libfrr, hash_release, hash, data, ret); + + return ret; } void hash_iterate(struct hash *hash, void (*func)(struct hash_bucket *, void *), |