[lttng-dev] [PATCH lttng-tools 3/3] Parse and show exclusions in the list command
Ikaheimonen, JP
jp_ikaheimonen at mentor.com
Fri Sep 27 03:14:51 EDT 2013
When showing tracepoint events in the list command,
parse the possible exclusions from the event name
and format the output nicely.
---
src/bin/lttng/commands/list.c | 58 +++++++++++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 13 deletions(-)
diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c
index 1c7085d..c977a52 100644
--- a/src/bin/lttng/commands/list.c
+++ b/src/bin/lttng/commands/list.c
@@ -213,20 +213,52 @@ static void print_events(struct lttng_event *event)
switch (event->type) {
case LTTNG_EVENT_TRACEPOINT:
{
- if (event->loglevel != -1) {
- MSG("%s%s (loglevel: %s (%d)) (type: tracepoint)%s%s",
- indent6,
- event->name,
- loglevel_string(event->loglevel),
- event->loglevel,
- enabled_string(event->enabled),
- filter_string(event->filter));
+ int base_name_length;
+ int excludes_found;
+ base_name_length = strcspn(event->name, "*") + 1;
+ if (base_name_length == strlen(event->name) + 1)
+ excludes_found = 0;
+ else if (base_name_length == strlen(event->name)
+ && event->name[base_name_length - 1] == '*')
+ excludes_found = 0;
+ else
+ excludes_found = 1;
+ if (excludes_found) {
+ if (event->loglevel != -1) {
+ MSG("%s%.*s excluding %s (loglevel: %s (%d)) (type: tracepoint)%s%s",
+ indent6,
+ base_name_length,
+ event->name,
+ event->name + base_name_length,
+ loglevel_string(event->loglevel),
+ event->loglevel,
+ enabled_string(event->enabled),
+ filter_string(event->filter));
+ } else {
+ MSG("%s%.*s excluding %s (type: tracepoint)%s%s",
+ indent6,
+ base_name_length,
+ event->name,
+ event->name + base_name_length,
+ enabled_string(event->enabled),
+ filter_string(event->filter));
+ }
} else {
- MSG("%s%s (type: tracepoint)%s%s",
- indent6,
- event->name,
- enabled_string(event->enabled),
- filter_string(event->filter));
+ if (event->loglevel != -1) {
+ MSG("%s%s (loglevel: %s (%d)) (type: tracepoint)%s%s",
+ indent6,
+ event->name,
+ loglevel_string(event->loglevel),
+ event->loglevel,
+ enabled_string(event->enabled),
+ filter_string(event->filter));
+ } else {
+ MSG("%s%s (type: tracepoint)%s%s",
+ indent6,
+ event->name,
+ enabled_string(event->enabled),
+ filter_string(event->filter));
+ }
}
break;
}
--
1.8.1.2
More information about the lttng-dev
mailing list