From 7b4aa11d71edf81f1e5a81a447b4e6b788551594 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sat, 29 Aug 2015 17:12:48 -0400 Subject: [PATCH] MI: add (event filter expression) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- src/common/config/config-session-abi.h | 1 + src/common/config/session-config.c | 1 + src/common/mi-lttng.c | 18 ++++++++++++++++++ src/common/mi_lttng.xsd | 1 + 4 files changed, 21 insertions(+) diff --git a/src/common/config/config-session-abi.h b/src/common/config/config-session-abi.h index 23f8c8416..f7cee34eb 100644 --- a/src/common/config/config-session-abi.h +++ b/src/common/config/config-session-abi.h @@ -60,6 +60,7 @@ extern const char * const config_element_snapshot_mode; extern const char * const config_element_loglevel; extern const char * const config_element_loglevel_type; extern const char * const config_element_filter; +extern const char * const config_element_filter_expression; extern const char * const config_element_snapshot_outputs; extern const char * const config_element_consumer_output; extern const char * const config_element_destination; diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index ba938d9f1..8fcb75230 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -109,6 +109,7 @@ const char * const config_element_snapshot_mode = "snapshot_mode"; const char * const config_element_loglevel = "loglevel"; const char * const config_element_loglevel_type = "loglevel_type"; const char * const config_element_filter = "filter"; +const char * const config_element_filter_expression = "filter_expression"; const char * const config_element_snapshot_outputs = "snapshot_outputs"; const char * const config_element_consumer_output = "consumer_output"; const char * const config_element_destination = "destination"; diff --git a/src/common/mi-lttng.c b/src/common/mi-lttng.c index fc22e4e0c..ef98687d8 100644 --- a/src/common/mi-lttng.c +++ b/src/common/mi-lttng.c @@ -922,6 +922,7 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer, struct lttng_event *event) { int ret; + const char *filter_expression; /* Open event element */ ret = mi_lttng_writer_open_element(writer, config_element_event); @@ -954,6 +955,23 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer, ret = mi_lttng_writer_write_element_bool(writer, config_element_filter, event->filter); + /* Event filter expression */ + ret = lttng_event_get_filter_string(event, &filter_expression); + + if (ret) { + goto end; + } + + if (filter_expression) { + ret = mi_lttng_writer_write_element_string(writer, + config_element_filter_expression, + filter_expression); + + if (ret) { + goto end; + } + } + end: return ret; } diff --git a/src/common/mi_lttng.xsd b/src/common/mi_lttng.xsd index efb62a20b..3992a8e71 100644 --- a/src/common/mi_lttng.xsd +++ b/src/common/mi_lttng.xsd @@ -197,6 +197,7 @@ THE SOFTWARE. + -- 2.34.1