#include "linklist.h"
#include "memory.h"
+#include "trace.h"
DEFINE_MTYPE_STATIC(LIB, LINK_LIST, "Link List")
DEFINE_MTYPE_STATIC(LIB, LINK_NODE, "Link Node")
struct listnode *listnode_add(struct list *list, void *val)
{
+ tracepoint(frr_libfrr, list_add, list, val);
+
struct listnode *node;
assert(val != NULL);
void listnode_delete(struct list *list, const void *val)
{
+ tracepoint(frr_libfrr, list_remove, list, val);
+
struct listnode *node = listnode_lookup(list, val);
if (node)
void list_delete_node(struct list *list, struct listnode *node)
{
+ tracepoint(frr_libfrr, list_delete_node, list, node);
+
if (node->prev)
node->prev->next = node->next;
else
void list_sort(struct list *list, int (*cmp)(const void **, const void **))
{
+ tracepoint(frr_libfrr, list_sort, list);
+
struct listnode *ln, *nn;
int i = -1;
void *data;
#include "memory.h"
#include "log.h"
+#include "trace.h"
static struct memgroup *mg_first = NULL;
struct memgroup **mg_insert = &mg_first;
static inline void mt_count_free(struct memtype *mt, void *ptr)
{
+ tracepoint(frr_libfrr, memfree, mt, ptr);
+
assert(mt->n_alloc);
atomic_fetch_sub_explicit(&mt->n_alloc, 1, memory_order_relaxed);
static inline void *mt_checkalloc(struct memtype *mt, void *ptr, size_t size)
{
+ tracepoint(frr_libfrr, memalloc, mt, ptr, size);
+
if (__builtin_expect(ptr == NULL, 0)) {
if (size) {
/* malloc(0) is allowed to return NULL */
lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY
lib_clippy_CFLAGS = $(PYTHON_CFLAGS)
-lib_clippy_LDADD = $(PYTHON_LIBS)
+lib_clippy_LDADD = $(PYTHON_LIBS) $(UST_LIBS)
lib_clippy_LDFLAGS = -export-dynamic
lib_clippy_SOURCES = \
lib/clippy.c \
lib/graph.c \
lib/memory.c \
lib/vector.c \
+ lib/trace.c \
# end
# (global) clippy rules for all directories
#include "hash.h"
#include "thread.h"
+#include "memory.h"
+#include "linklist.h"
/* clang-format off */
)
)
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ memalloc,
+ TP_ARGS(
+ struct memtype *, mt, void *, ptr, size_t, size
+ ),
+ TP_FIELDS(
+ ctf_string(memtype, mt->name)
+ ctf_integer(size_t, size, size)
+ ctf_integer_hex(intptr_t, ptr, ptr)
+ )
+)
+
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ memfree,
+ TP_ARGS(
+ struct memtype *, mt, void *, ptr
+ ),
+ TP_FIELDS(
+ ctf_string(memtype, mt->name)
+ ctf_integer_hex(intptr_t, ptr, ptr)
+ )
+)
+
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ list_add,
+ TP_ARGS(
+ struct list *, list, const void *, ptr
+ ),
+ TP_FIELDS(
+ ctf_integer_hex(intptr_t, list, list)
+ ctf_integer(unsigned int, count, list->count)
+ ctf_integer_hex(intptr_t, ptr, ptr)
+ )
+)
+
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ list_remove,
+ TP_ARGS(
+ struct list *, list, const void *, ptr
+ ),
+ TP_FIELDS(
+ ctf_integer_hex(intptr_t, list, list)
+ ctf_integer(unsigned int, count, list->count)
+ ctf_integer_hex(intptr_t, ptr, ptr)
+ )
+)
+
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ list_delete_node,
+ TP_ARGS(
+ struct list *, list, const void *, node
+ ),
+ TP_FIELDS(
+ ctf_integer_hex(intptr_t, list, list)
+ ctf_integer(unsigned int, count, list->count)
+ ctf_integer_hex(intptr_t, node, node)
+ )
+)
+
+TRACEPOINT_EVENT(
+ frr_libfrr,
+ list_sort,
+ TP_ARGS(
+ struct list *, list
+ ),
+ TP_FIELDS(
+ ctf_integer_hex(intptr_t, list, list)
+ ctf_integer(unsigned int, count, list->count)
+ )
+)
+
/* clang-format on */
#include <lttng/tracepoint-event.h>