X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=include%2Fust%2Fust_trace.h;h=21c941a641cb02426ef6616c6bf7135902aaa562;hb=cc7b66ba103c213a84159c2128cd4096507bdd2b;hp=e1b02576d6ef93b88c45bca1cdcdcf071e355d09;hpb=9dec086e052cf7f583a3afaa3aab48a6de8d38ac;p=ust.git diff --git a/include/ust/ust_trace.h b/include/ust/ust_trace.h index e1b0257..21c941a 100644 --- a/include/ust/ust_trace.h +++ b/include/ust/ust_trace.h @@ -23,6 +23,8 @@ * to a printf */ +#include + /* * Stage 1. Create a struct and a printf calling function * that is connected to the tracepoint at load time. @@ -66,11 +68,27 @@ \ printf(print); \ } \ + static inline int register_event_##name(void *data) \ + { \ + return register_tracepoint(name, trace_printf_##name, data); \ + } \ + static inline int unregister_event_##name(void *data) \ + { \ + return unregister_tracepoint(name, trace_printf_##name, data); \ + } \ + struct trace_event __event_##name = { \ + __tpstrtab_##name, \ + register_event_##name, \ + unregister_event_##name \ + }; \ + static struct trace_event * const __event_ptrs_##name \ + __attribute__((used, section("__trace_events_ptrs"))) = \ + &__event_##name; \ + \ static void __attribute__((constructor)) init_##name() \ { \ - void *dummy; \ - printf("connecting tracepoint " #name "\n"); \ - register_trace_##name(trace_printf_##name, dummy); \ + void *dummy = NULL; \ + register_tracepoint(name, trace_printf_##name, dummy); \ }