From 6ddc916dfa930b6b9018ffd53a76faeb61b81ebd Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 20 Sep 2012 12:39:47 -0400 Subject: [PATCH] Add support for model.emf.uri event info Declared with: TRACEPOINT_MODEL_EMF_URI(provider, event, "string") this info is optional, can be added in the tracepoint probe. Signed-off-by: Mathieu Desnoyers --- include/lttng/tracepoint.h | 6 ++++++ include/lttng/ust-events.h | 7 ++++++- include/lttng/ust-tracepoint-event-reset.h | 3 +++ include/lttng/ust-tracepoint-event.h | 19 +++++++++++++++++++ liblttng-ust/ltt-events.c | 8 ++++++++ tests/demo/ust_tests_demo.h | 10 ++++++++++ 6 files changed, 52 insertions(+), 1 deletion(-) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index e1de626c..8b089144 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -518,3 +518,9 @@ enum { #define TRACEPOINT_LOGLEVEL(provider, name, loglevel) #endif /* #ifndef TRACEPOINT_LOGLEVEL */ + +#ifndef TRACEPOINT_MODEL_EMF_URI + +#define TRACEPOINT_MODEL_EMF_URI(provider, name, uri) + +#endif /* #ifndef TRACEPOINT_MODEL_EMF_URI */ diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index daf58902..0e19ed22 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -225,7 +225,12 @@ struct lttng_event_desc { unsigned int nr_fields; const int **loglevel; const char *signature; /* Argument types/names received */ - char padding[LTTNG_UST_EVENT_DESC_PADDING]; + union { + struct { + const char **model_emf_uri; + } ext; + char padding[LTTNG_UST_EVENT_DESC_PADDING]; + } u; }; #define LTTNG_UST_PROBE_DESC_PADDING 40 diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index e76072fc..c3c9fce2 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -32,6 +32,9 @@ #undef TRACEPOINT_LOGLEVEL #define TRACEPOINT_LOGLEVEL(provider, name, loglevel) +#undef TRACEPOINT_MODEL_EMF_URI +#define TRACEPOINT_MODEL_EMF_URI(provider, name, uri) + #undef _ctf_integer_ext #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, \ _nowrite) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index aaba93ea..8f0db41f 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -547,6 +547,21 @@ static const int *_loglevel___##__provider##___##__name = \ #include TRACEPOINT_INCLUDE +/* + * Stage 6.1 of tracepoint event generation. + * + * Tracepoint UML URI info. + */ + +/* Reset all macros within TRACEPOINT_EVENT */ +#include + +#undef TRACEPOINT_MODEL_EMF_URI +#define TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \ +static const char *_model_emf_uri___##__provider##___##__name = __uri; + +#include TRACEPOINT_INCLUDE + /* * Stage 7.1 of tracepoint event generation. * @@ -563,6 +578,9 @@ static const int *_loglevel___##__provider##___##__name = \ static const int * \ __ref_loglevel___##_provider##___##_name \ __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \ +static const char * \ + __ref_model_emf_uri___##_provider##___##_name \ + __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\ const struct lttng_event_desc __event_desc___##_provider##_##_name = { \ .fields = __event_fields___##_provider##___##_template, \ .name = #_provider ":" #_name, \ @@ -570,6 +588,7 @@ const struct lttng_event_desc __event_desc___##_provider##_##_name = { \ .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \ .loglevel = &__ref_loglevel___##_provider##___##_name, \ .signature = __tp_event_signature___##_provider##___##_template, \ + .u.ext.model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \ }; #include TRACEPOINT_INCLUDE diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index ab099e1a..5d147519 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -930,6 +930,14 @@ int _ltt_event_metadata_statedump(struct ltt_session *session, if (ret) goto end; + if (event->desc->u.ext.model_emf_uri) { + ret = lttng_metadata_printf(session, + " model.emf.uri = \"%s\";\n", + *(event->desc->u.ext.model_emf_uri)); + if (ret) + goto end; + } + if (event->ctx) { ret = lttng_metadata_printf(session, " context := struct {\n"); diff --git a/tests/demo/ust_tests_demo.h b/tests/demo/ust_tests_demo.h index 1b761f9f..680b0e69 100644 --- a/tests/demo/ust_tests_demo.h +++ b/tests/demo/ust_tests_demo.h @@ -32,6 +32,13 @@ TRACEPOINT_EVENT(ust_tests_demo, starting, ) TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT) +/* + * Dummy model information, just for example. TODO: we should check if + * EMF model URI have some standard format we should follow. + */ +TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, starting, + "http://example.com/path_to_model?q=ust_tests_demo:starting") + TRACEPOINT_EVENT(ust_tests_demo, done, TP_ARGS(int, value), TP_FIELDS( @@ -40,6 +47,9 @@ TRACEPOINT_EVENT(ust_tests_demo, done, ) TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT) +TRACEPOINT_MODEL_EMF_URI(ust_tests_demo, done, + "http://example.com/path_to_model?q=ust_tests_demo:done") + #endif /* _TRACEPOINT_UST_TESTS_DEMO_H */ #undef TRACEPOINT_INCLUDE_FILE -- 2.34.1