From 612e9ce4e5cc3a1292522a563789f6aab6c421b1 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 20 Apr 2021 13:17:11 -0400 Subject: [PATCH] Tracepoint API namespacing 'TRACEPOINT_LOGLEVEL' The ABI bump gives us the opportunity to namespace all public symbols under the 'lttng_ust_' prefix. Namespace all API symbols and macros under 'lttng_ust_' / 'LTTNG_UST_' and add compat macros to keep compatibility with the previous API. Change-Id: I3be1cdd214cfcad38613fdae0e9620f9ee8d0437 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- doc/examples/demo-tracelog/demo-tracelog.c | 2 +- doc/examples/demo-tracelog/demo-vtracelog.c | 2 +- doc/examples/demo/ust_tests_demo.h | 4 +- doc/examples/demo/ust_tests_demo2.h | 2 +- doc/examples/demo/ust_tests_demo3.h | 2 +- .../easy-ust/sample_component_provider.h | 16 ++-- doc/examples/gen-tp/sample_tracepoint.tp | 4 +- include/lttng/tp/lttng-ust-tracef.h | 2 +- include/lttng/tp/lttng-ust-tracelog.h | 32 +++---- include/lttng/tracelog.h | 30 +++--- include/lttng/tracepoint-event.h | 4 +- include/lttng/tracepoint.h | 92 +++++++++++-------- include/lttng/ust-tracepoint-event-reset.h | 7 +- include/lttng/ust-tracepoint-event.h | 4 +- src/common/tracepoint.h | 2 +- .../lttng-ust-cyg-profile-fast.h | 8 +- .../lttng-ust-cyg-profile.h | 8 +- src/lib/lttng-ust/lttng-events.c | 10 +- src/lib/lttng-ust/lttng-probes.c | 6 +- src/lib/lttng-ust/tracelog.c | 30 +++--- .../same_line_tracepoint/ust_tests_sameline.h | 4 +- tools/lttng-gen-tp | 4 +- 22 files changed, 147 insertions(+), 128 deletions(-) diff --git a/doc/examples/demo-tracelog/demo-tracelog.c b/doc/examples/demo-tracelog/demo-tracelog.c index 1950a7f4..5a7f0f96 100644 --- a/doc/examples/demo-tracelog/demo-tracelog.c +++ b/doc/examples/demo-tracelog/demo-tracelog.c @@ -25,7 +25,7 @@ int main(int argc, char **argv) fprintf(stderr, "Tracing... "); for (i = 0; i < 5; i++) { - tracelog(TRACE_ERR, "Error condition %d", i); + tracelog(LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR, "Error condition %d", i); } fprintf(stderr, " done.\n"); return 0; diff --git a/doc/examples/demo-tracelog/demo-vtracelog.c b/doc/examples/demo-tracelog/demo-vtracelog.c index c396a300..05b496f5 100644 --- a/doc/examples/demo-tracelog/demo-vtracelog.c +++ b/doc/examples/demo-tracelog/demo-vtracelog.c @@ -20,7 +20,7 @@ void print_err(const char* msg, ...) va_list ap; va_start(ap, msg); - vtracelog(TRACE_ERR, msg, ap); + vtracelog(LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR, msg, ap); va_end(ap); } diff --git a/doc/examples/demo/ust_tests_demo.h b/doc/examples/demo/ust_tests_demo.h index 7bf37c22..b9384f48 100644 --- a/doc/examples/demo/ust_tests_demo.h +++ b/doc/examples/demo/ust_tests_demo.h @@ -18,7 +18,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_demo, starting, ctf_integer(int, value, value) ) ) -TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT) /* * Dummy model information, just for example. TODO: we should check if @@ -33,7 +33,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_demo, done, ctf_integer(int, value, value) ) ) -TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_demo, done, LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT) TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, done, "http://example.com/path_to_model?q=ust_tests_demo:done") diff --git a/doc/examples/demo/ust_tests_demo2.h b/doc/examples/demo/ust_tests_demo2.h index bdcb6326..a7e9abea 100644 --- a/doc/examples/demo/ust_tests_demo2.h +++ b/doc/examples/demo/ust_tests_demo2.h @@ -34,7 +34,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_demo2, loop, ctf_float(double, doublefield, doublearg) ) ) -TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */ diff --git a/doc/examples/demo/ust_tests_demo3.h b/doc/examples/demo/ust_tests_demo3.h index 0e5960e5..7ac7d9b7 100644 --- a/doc/examples/demo/ust_tests_demo3.h +++ b/doc/examples/demo/ust_tests_demo3.h @@ -18,7 +18,7 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_demo3, done, ctf_integer(int, value, value) ) ) -TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) #endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */ diff --git a/doc/examples/easy-ust/sample_component_provider.h b/doc/examples/easy-ust/sample_component_provider.h index 4e9327b9..97881808 100644 --- a/doc/examples/easy-ust/sample_component_provider.h +++ b/doc/examples/easy-ust/sample_component_provider.h @@ -88,13 +88,15 @@ LTTNG_UST_TRACEPOINT_EVENT( ) ) /* - * Trace loglevel, shows the level of the trace event. It can be TRACE_EMERG, - * TRACE_ALERT, TRACE_CRIT, TRACE_ERR, TRACE_WARNING, TRACE_INFO or others. - * If this is not set, TRACE_DEFAULT is assumed. - * The first two arguments identify the tracepoint - * See details in line 347 + * Trace loglevel, shows the level of the trace event. It can be + * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG, LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT, + * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT, LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR, + * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO or + * others. If this is not set, LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT is + * assumed. The first two arguments identify the tracepoint See details in + * line 347 */ -TRACEPOINT_LOGLEVEL( +LTTNG_UST_TRACEPOINT_LOGLEVEL( /* * The provider name, must be the same as the provider name in the * LTTNG_UST_TRACEPOINT_EVENT and as TRACEPOINT_PROVIDER above. @@ -109,7 +111,7 @@ TRACEPOINT_LOGLEVEL( * The tracepoint loglevel. Warning, some levels are abbreviated and * others are not, please see */ - TRACE_WARNING) + LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) #endif /* _SAMPLE_COMPONENT_PROVIDER_H */ diff --git a/doc/examples/gen-tp/sample_tracepoint.tp b/doc/examples/gen-tp/sample_tracepoint.tp index c528c35a..62489262 100644 --- a/doc/examples/gen-tp/sample_tracepoint.tp +++ b/doc/examples/gen-tp/sample_tracepoint.tp @@ -9,7 +9,7 @@ LTTNG_UST_TRACEPOINT_EVENT( /* * Longer comments */ -TRACEPOINT_LOGLEVEL( +LTTNG_UST_TRACEPOINT_LOGLEVEL( sample_tracepoint, message, - TRACE_WARNING) + LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) diff --git a/include/lttng/tp/lttng-ust-tracef.h b/include/lttng/tp/lttng-ust-tracef.h index 393a5e0e..1be1468c 100644 --- a/include/lttng/tp/lttng-ust-tracef.h +++ b/include/lttng/tp/lttng-ust-tracef.h @@ -14,4 +14,4 @@ LTTNG_UST_TRACEPOINT_EVENT(lttng_ust_tracef, event, ctf_unused(ip) ) ) -TRACEPOINT_LOGLEVEL(lttng_ust_tracef, event, TRACE_DEBUG) +LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_tracef, event, LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG) diff --git a/include/lttng/tp/lttng-ust-tracelog.h b/include/lttng/tp/lttng-ust-tracelog.h index 91f40854..6aa3e8a9 100644 --- a/include/lttng/tp/lttng-ust-tracelog.h +++ b/include/lttng/tp/lttng-ust-tracelog.h @@ -24,20 +24,20 @@ LTTNG_UST_TRACEPOINT_EVENT_CLASS(lttng_ust_tracelog, tlclass, LTTNG_UST_TP_ARGS(const char *, file, int, line, const char *, func, \ const char *, msg, unsigned int, len, void *, ip) \ ) \ - TRACEPOINT_LOGLEVEL(lttng_ust_tracelog, _level_enum, _level_enum) + LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_tracelog, _level_enum, _level_enum) -TP_TRACELOG_TEMPLATE(TRACE_EMERG) -TP_TRACELOG_TEMPLATE(TRACE_ALERT) -TP_TRACELOG_TEMPLATE(TRACE_CRIT) -TP_TRACELOG_TEMPLATE(TRACE_ERR) -TP_TRACELOG_TEMPLATE(TRACE_WARNING) -TP_TRACELOG_TEMPLATE(TRACE_NOTICE) -TP_TRACELOG_TEMPLATE(TRACE_INFO) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_SYSTEM) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_PROGRAM) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_PROCESS) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_MODULE) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_UNIT) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_FUNCTION) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG_LINE) -TP_TRACELOG_TEMPLATE(TRACE_DEBUG) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE) +TP_TRACELOG_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG) diff --git a/include/lttng/tracelog.h b/include/lttng/tracelog.h index d997f74c..f2009941 100644 --- a/include/lttng/tracelog.h +++ b/include/lttng/tracelog.h @@ -23,21 +23,21 @@ extern "C" { va_list ap) \ __attribute__ ((format(printf, 4, 0))); -TP_TRACELOG_CB_TEMPLATE(TRACE_EMERG); -TP_TRACELOG_CB_TEMPLATE(TRACE_ALERT); -TP_TRACELOG_CB_TEMPLATE(TRACE_CRIT); -TP_TRACELOG_CB_TEMPLATE(TRACE_ERR); -TP_TRACELOG_CB_TEMPLATE(TRACE_WARNING); -TP_TRACELOG_CB_TEMPLATE(TRACE_NOTICE); -TP_TRACELOG_CB_TEMPLATE(TRACE_INFO); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_SYSTEM); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_PROGRAM); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_PROCESS); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_MODULE); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_UNIT); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_FUNCTION); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_LINE); -TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE); +TP_TRACELOG_CB_TEMPLATE(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG); #undef TP_TRACELOG_CB_TEMPLATE diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h index 30e6523d..829e962d 100644 --- a/include/lttng/tracepoint-event.h +++ b/include/lttng/tracepoint-event.h @@ -53,8 +53,8 @@ LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) -#undef TRACEPOINT_LOGLEVEL -#define TRACEPOINT_LOGLEVEL(provider, name, loglevel) +#undef LTTNG_UST_TRACEPOINT_LOGLEVEL +#define LTTNG_UST_TRACEPOINT_LOGLEVEL(provider, name, loglevel) #undef TRACEPOINT_MODEL_EMF_URI #define TRACEPOINT_MODEL_EMF_URI(provider, name, uri) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 71250ce0..8fa73ce7 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -747,7 +747,7 @@ lttng_ust__tracepoints__ptrs_destroy(void) #endif /* #ifndef LTTNG_UST_TRACEPOINT_EVENT */ -#ifndef TRACEPOINT_LOGLEVEL +#ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL /* * Tracepoint Loglevels @@ -761,85 +761,105 @@ lttng_ust__tracepoints__ptrs_destroy(void) * semantic. Loglevels 7 through 13 offer more fine-grained selection of * debug information. * - * TRACE_EMERG 0 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG 0 * system is unusable * - * TRACE_ALERT 1 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT 1 * action must be taken immediately * - * TRACE_CRIT 2 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT 2 * critical conditions * - * TRACE_ERR 3 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR 3 * error conditions * - * TRACE_WARNING 4 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING 4 * warning conditions * - * TRACE_NOTICE 5 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE 5 * normal, but significant, condition * - * TRACE_INFO 6 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO 6 * informational message * - * TRACE_DEBUG_SYSTEM 7 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM 7 * debug information with system-level scope (set of programs) * - * TRACE_DEBUG_PROGRAM 8 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM 8 * debug information with program-level scope (set of processes) * - * TRACE_DEBUG_PROCESS 9 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS 9 * debug information with process-level scope (set of modules) * - * TRACE_DEBUG_MODULE 10 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE 10 * debug information with module (executable/library) scope (set of units) * - * TRACE_DEBUG_UNIT 11 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT 11 * debug information with compilation unit scope (set of functions) * - * TRACE_DEBUG_FUNCTION 12 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION 12 * debug information with function-level scope * - * TRACE_DEBUG_LINE 13 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE 13 * debug information with line-level scope (LTTNG_UST_TRACEPOINT_EVENT default) * - * TRACE_DEBUG 14 + * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG 14 * debug-level message * * Declare tracepoint loglevels for tracepoints. A LTTNG_UST_TRACEPOINT_EVENT - * should be declared prior to the the TRACEPOINT_LOGLEVEL for a given + * should be declared prior to the the LTTNG_UST_TRACEPOINT_LOGLEVEL for a given * tracepoint name. The first field is the provider name, the second * field is the name of the tracepoint, the third field is the loglevel * name. * - * TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >, + * LTTNG_UST_TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >, * < loglevel_name >) * * The TRACEPOINT_PROVIDER must be already declared before declaring a - * TRACEPOINT_LOGLEVEL. + * LTTNG_UST_TRACEPOINT_LOGLEVEL. */ enum { - TRACE_EMERG = 0, - TRACE_ALERT = 1, - TRACE_CRIT = 2, - TRACE_ERR = 3, - TRACE_WARNING = 4, - TRACE_NOTICE = 5, - TRACE_INFO = 6, - TRACE_DEBUG_SYSTEM = 7, - TRACE_DEBUG_PROGRAM = 8, - TRACE_DEBUG_PROCESS = 9, - TRACE_DEBUG_MODULE = 10, - TRACE_DEBUG_UNIT = 11, - TRACE_DEBUG_FUNCTION = 12, - TRACE_DEBUG_LINE = 13, - TRACE_DEBUG = 14, + LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG = 0, + LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT = 1, + LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT = 2, + LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR = 3, + LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING = 4, + LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE = 5, + LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO = 6, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM = 7, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM = 8, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS = 9, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE = 10, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT = 11, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION = 12, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE = 13, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG = 14, }; -#define TRACEPOINT_LOGLEVEL(provider, name, loglevel) +#define LTTNG_UST_TRACEPOINT_LOGLEVEL(provider, name, loglevel) -#endif /* #ifndef TRACEPOINT_LOGLEVEL */ +#if LTTNG_UST_COMPAT_API(0) +#define TRACEPOINT_LOGLEVEL LTTNG_UST_TRACEPOINT_LOGLEVEL + +#define TRACE_EMERG LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG +#define TRACE_ALERT LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT +#define TRACE_CRIT LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT +#define TRACE_ERR LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR +#define TRACE_WARNING LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING +#define TRACE_NOTICE LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE +#define TRACE_INFO LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO +#define TRACE_DEBUG_SYSTEM LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM +#define TRACE_DEBUG_PROGRAM LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM +#define TRACE_DEBUG_PROCESS LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS +#define TRACE_DEBUG_MODULE LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE +#define TRACE_DEBUG_UNIT LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT +#define TRACE_DEBUG_FUNCTION LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION +#define TRACE_DEBUG_LINE LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE +#define TRACE_DEBUG LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG +#endif + +#endif /* #ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL */ #ifndef TRACEPOINT_MODEL_EMF_URI diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index a4d13b10..5acf5a1b 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -21,11 +21,8 @@ #undef LTTNG_UST_TP_FIELDS #define LTTNG_UST_TP_FIELDS(...) -#undef TRACEPOINT_LOGLEVEL_ENUM -#define TRACEPOINT_LOGLEVEL_ENUM(...) - -#undef TRACEPOINT_LOGLEVEL -#define TRACEPOINT_LOGLEVEL(provider, name, loglevel) +#undef LTTNG_UST_TRACEPOINT_LOGLEVEL +#define LTTNG_UST_TRACEPOINT_LOGLEVEL(provider, name, loglevel) #undef TRACEPOINT_MODEL_EMF_URI #define TRACEPOINT_MODEL_EMF_URI(provider, name, uri) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index fa4739ce..569431f1 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -971,8 +971,8 @@ static const char __tp_event_signature___##_provider##___##_name[] = \ #define LTTNG_UST_TP_EXTERN_C #endif -#undef TRACEPOINT_LOGLEVEL -#define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \ +#undef LTTNG_UST_TRACEPOINT_LOGLEVEL +#define LTTNG_UST_TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \ static const int _loglevel_value___##__provider##___##__name = __loglevel; \ LTTNG_UST_TP_EXTERN_C const int * const _loglevel___##__provider##___##__name \ __attribute__((visibility("hidden"))) = \ diff --git a/src/common/tracepoint.h b/src/common/tracepoint.h index 6c95ccbd..e4609958 100644 --- a/src/common/tracepoint.h +++ b/src/common/tracepoint.h @@ -7,7 +7,7 @@ #ifndef _UST_COMMON_TRACEPOINT_H #define _UST_COMMON_TRACEPOINT_H -#define TRACE_DEFAULT TRACE_DEBUG_LINE +#define LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE /* * These symbols are ABI between liblttng-ust-tracepoint and liblttng-ust, diff --git a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.h b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.h index 81b67714..7c1d5b83 100644 --- a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.h +++ b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.h @@ -24,8 +24,8 @@ LTTNG_UST_TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_entry, ) ) -TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_entry, - TRACE_DEBUG_FUNCTION) +LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_entry, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) LTTNG_UST_TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_exit, LTTNG_UST_TP_ARGS(void *, func_addr), @@ -34,8 +34,8 @@ LTTNG_UST_TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_exit, ) ) -TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_exit, - TRACE_DEBUG_FUNCTION) +LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_exit, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) #endif /* _TRACEPOINT_LTTNG_UST_CYG_PROFILE_FAST_H */ diff --git a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h index 0df21538..4a75c5ea 100644 --- a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h +++ b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h @@ -31,16 +31,16 @@ LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class, LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site) ) -TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_entry, - TRACE_DEBUG_FUNCTION) +LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_entry, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class, func_exit, LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site) ) -TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_exit, - TRACE_DEBUG_FUNCTION) +LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_exit, + LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) #endif /* _TRACEPOINT_LTTNG_UST_CYG_PROFILE_H */ diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 33737e4d..38610613 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -120,23 +120,23 @@ int lttng_loglevel_match(int loglevel, int req_loglevel) { if (!has_loglevel) - loglevel = TRACE_DEFAULT; + loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; switch (req_type) { case LTTNG_UST_ABI_LOGLEVEL_RANGE: if (loglevel <= req_loglevel - || (req_loglevel == -1 && loglevel <= TRACE_DEBUG)) + || (req_loglevel == -1 && loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG)) return 1; else return 0; case LTTNG_UST_ABI_LOGLEVEL_SINGLE: if (loglevel == req_loglevel - || (req_loglevel == -1 && loglevel <= TRACE_DEBUG)) + || (req_loglevel == -1 && loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG)) return 1; else return 0; case LTTNG_UST_ABI_LOGLEVEL_ALL: default: - if (loglevel <= TRACE_DEBUG) + if (loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG) return 1; else return 0; @@ -779,7 +779,7 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, if (desc->loglevel) loglevel = *(*desc->loglevel); else - loglevel = TRACE_DEFAULT; + loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; if (desc->model_emf_uri) uri = *(desc->model_emf_uri); else diff --git a/src/lib/lttng-ust/lttng-probes.c b/src/lib/lttng-ust/lttng-probes.c index 4552e5e8..a0e9fffa 100644 --- a/src/lib/lttng-ust/lttng-probes.c +++ b/src/lib/lttng-ust/lttng-probes.c @@ -259,7 +259,7 @@ int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list) cds_list_add(&list_entry->head, &list->head); lttng_ust_format_event_name(event_desc, list_entry->tp.name); if (!event_desc->loglevel) { - list_entry->tp.loglevel = TRACE_DEFAULT; + list_entry->tp.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; } else { list_entry->tp.loglevel = *(*event_desc->loglevel); } @@ -341,7 +341,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list) list_entry->field.field_name[0] = '\0'; list_entry->field.type = LTTNG_UST_ABI_FIELD_OTHER; if (!event_desc->loglevel) { - list_entry->field.loglevel = TRACE_DEFAULT; + list_entry->field.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; } else { list_entry->field.loglevel = *(*event_desc->loglevel); } @@ -394,7 +394,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list) list_entry->field.type = LTTNG_UST_ABI_FIELD_OTHER; } if (!event_desc->loglevel) { - list_entry->field.loglevel = TRACE_DEFAULT; + list_entry->field.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; } else { list_entry->field.loglevel = *(*event_desc->loglevel); } diff --git a/src/lib/lttng-ust/tracelog.c b/src/lib/lttng-ust/tracelog.c index f506e8ae..e5bd3890 100644 --- a/src/lib/lttng-ust/tracelog.c +++ b/src/lib/lttng-ust/tracelog.c @@ -72,18 +72,18 @@ va_end(ap); \ } -TRACELOG_CB(TRACE_EMERG) -TRACELOG_CB(TRACE_ALERT) -TRACELOG_CB(TRACE_CRIT) -TRACELOG_CB(TRACE_ERR) -TRACELOG_CB(TRACE_WARNING) -TRACELOG_CB(TRACE_NOTICE) -TRACELOG_CB(TRACE_INFO) -TRACELOG_CB(TRACE_DEBUG_SYSTEM) -TRACELOG_CB(TRACE_DEBUG_PROGRAM) -TRACELOG_CB(TRACE_DEBUG_PROCESS) -TRACELOG_CB(TRACE_DEBUG_MODULE) -TRACELOG_CB(TRACE_DEBUG_UNIT) -TRACELOG_CB(TRACE_DEBUG_FUNCTION) -TRACELOG_CB(TRACE_DEBUG_LINE) -TRACELOG_CB(TRACE_DEBUG) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE) +TRACELOG_CB(LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG) diff --git a/tests/compile/same_line_tracepoint/ust_tests_sameline.h b/tests/compile/same_line_tracepoint/ust_tests_sameline.h index 5efd4808..ba76c1a2 100644 --- a/tests/compile/same_line_tracepoint/ust_tests_sameline.h +++ b/tests/compile/same_line_tracepoint/ust_tests_sameline.h @@ -16,13 +16,13 @@ LTTNG_UST_TRACEPOINT_EVENT(ust_tests_sameline, event1, LTTNG_UST_TP_ARGS(), LTTNG_UST_TP_FIELDS() ) -TRACEPOINT_LOGLEVEL(ust_tests_sameline, event1, TRACE_CRIT) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_sameline, event1, TRACE_CRIT) LTTNG_UST_TRACEPOINT_EVENT(ust_tests_sameline, event2, LTTNG_UST_TP_ARGS(), LTTNG_UST_TP_FIELDS() ) -TRACEPOINT_LOGLEVEL(ust_tests_sameline, event2, TRACE_CRIT) +LTTNG_UST_TRACEPOINT_LOGLEVEL(ust_tests_sameline, event2, TRACE_CRIT) #endif /* _TRACEPOINT_UST_TESTS_SAMELINE_H */ diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp index b318d1cd..c3ee7c5e 100755 --- a/tools/lttng-gen-tp +++ b/tools/lttng-gen-tp @@ -170,7 +170,7 @@ class TemplateFile: cleantext = re.sub("\s*", "", nolinecomment) # Remove multine C style comments nocomment = re.sub("/\*.*?\*/", "", cleantext) - entries = re.split("LTTNG_UST_TRACEPOINT_.*?", nocomment) + entries = re.split("^LTTNG_UST_TRACEPOINT_.*?", nocomment) for entry in entries: if entry != '': @@ -200,7 +200,7 @@ usage = """ When using the -o option, the OUTPUT_FILE must end with either .h, .c or .o The -o option can be repeated multiple times. - The template file must contains LTTNG_UST_TRACEPOINT_EVENT and TRACEPOINT_LOGLEVEL + The template file must contains LTTNG_UST_TRACEPOINT_EVENT and LTTNG_UST_TRACEPOINT_LOGLEVEL as per defined in the lttng/tracepoint.h file. See the lttng-ust(3) man page for more details on the format. """ -- 2.34.1