From 8511626a5d7af3d9c447f64dd1ecd9e2ce22763a Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 18 Nov 2011 12:05:43 -0500 Subject: [PATCH 1/1] Basic tracepoint event implementation Signed-off-by: Mathieu Desnoyers --- include/lttng/tracepoint-event.h | 45 +++++++++++++++++++++++++++ include/lttng/ust-tracepoint-event.h | 0 liblttng-ust/probes/lttng-probe-ust.h | 4 +-- tests/demo/ust_tests_demo.h | 4 +-- tests/hello/ust_tests_hello.h | 4 +-- 5 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 include/lttng/tracepoint-event.h create mode 100644 include/lttng/ust-tracepoint-event.h diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h new file mode 100644 index 00000000..2cbe4475 --- /dev/null +++ b/include/lttng/tracepoint-event.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011 - Mathieu Desnoyers + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef TRACEPOINT_CREATE_PROBES + +#define __tp_stringify1(x) #x +#define __tp_stringify(x) __tp_stringify1(x) + +#undef TRACEPOINT_EVENT_INSTANCE +#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ + _DEFINE_TRACEPOINT(provider, name) + +#undef TRACEPOINT_EVENT +#define TRACEPOINT_EVENT(_provider, _name, _args, _fields) \ + TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, _TP_PARAMS(_args)) + +#define TRACEPOINT_INCLUDE __tp_stringify(TRACEPOINT_INCLUDE_FILE) + +#undef TRACEPOINT_CREATE_PROBES + +#define TRACEPOINT_HEADER_MULTI_READ +#include TRACEPOINT_INCLUDE +#undef TRACEPOINT_HEADER_MULTI_READ + +#define TRACEPOINT_CREATE_PROBES + +#endif /* TRACEPOINT_CREATE_PROBES */ + +#ifdef __cplusplus +} +#endif diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h new file mode 100644 index 00000000..e69de29b diff --git a/liblttng-ust/probes/lttng-probe-ust.h b/liblttng-ust/probes/lttng-probe-ust.h index 5fd016ae..1c55ccd7 100644 --- a/liblttng-ust/probes/lttng-probe-ust.h +++ b/liblttng-ust/probes/lttng-probe-ust.h @@ -38,10 +38,8 @@ TRACEPOINT_EVENT(lttng_ust, metadata, ) ) -#undef TRACEPOINT_INCLUDE_PATH -#define TRACEPOINT_INCLUDE_PATH ./probes #undef TRACEPOINT_INCLUDE_FILE -#define TRACEPOINT_INCLUDE_FILE lttng-probe-ust +#define TRACEPOINT_INCLUDE_FILE ./probes/lttng-probe-ust.h #endif /* _TRACEPOINT_LTTNG_UST_H */ diff --git a/tests/demo/ust_tests_demo.h b/tests/demo/ust_tests_demo.h index f0aa5d1a..486b3ae9 100644 --- a/tests/demo/ust_tests_demo.h +++ b/tests/demo/ust_tests_demo.h @@ -61,10 +61,8 @@ TRACEPOINT_EVENT(ust_tests_demo, done, #endif /* _TRACEPOINT_UST_TESTS_DEMO_H */ -#undef TRACEPOINT_INCLUDE_PATH -#define TRACEPOINT_INCLUDE_PATH . #undef TRACEPOINT_INCLUDE_FILE -#define TRACEPOINT_INCLUDE_FILE ust_tests_demo +#define TRACEPOINT_INCLUDE_FILE ./ust_tests_demo.h /* This part must be outside ifdef protection */ #include diff --git a/tests/hello/ust_tests_hello.h b/tests/hello/ust_tests_hello.h index d0f5b5c8..a54bc595 100644 --- a/tests/hello/ust_tests_hello.h +++ b/tests/hello/ust_tests_hello.h @@ -52,10 +52,8 @@ TRACEPOINT_EVENT(ust_tests_hello, tptest_sighandler, #endif /* _TRACEPOINT_UST_TESTS_HELLO_H */ -#undef TRACEPOINT_INCLUDE_PATH -#define TRACEPOINT_INCLUDE_PATH . #undef TRACEPOINT_INCLUDE_FILE -#define TRACEPOINT_INCLUDE_FILE ust_tests_hello +#define TRACEPOINT_INCLUDE_FILE ./ust_tests_hello.h /* This part must be outside ifdef protection */ #include -- 2.34.1