Re: [RFC][PATCH] tracing: Show available event triggers when no trigger is set

From: Namhyung Kim
Date: Wed Jan 08 2014 - 02:51:01 EST


Hi Steve,

On Tue, 7 Jan 2014 10:35:48 -0500, Steven Rostedt wrote:
> Currently there's no way to know what triggers exist on a kernel without
> looking at the source of the kernel or randomly trying out triggers.
> Instead of creating another file in the debugfs system, simply show
> what available triggers are there when cat'ing the trigger file when
> it has no events:
>
> [root /sys/kernel/debug/tracing]# cat events/sched/sched_switch/trigger
> # Available triggers:
> # disable_event enable_event stacktrace snapshot traceoff traceon
>
> This stays consistent with other debugfs files where meta data like
> this is always proceeded with a '#' at the start of the line so that
> tools can strip these out.

[SNIP]
> + if (v == SHOW_AVAILABLE_TRIGGERS) {
> + seq_puts(m, "# Available triggers:\n");
> + seq_putc(m, '#');
> + mutex_lock(&trigger_cmd_mutex);
> + list_for_each_entry(p, &trigger_commands, list)

I guess the list_for_each_entry_reverse() will give a more intuitive
result here:

[root /sys/kernel/debug/tracing]# cat events/sched/sched_switch/trigger
# Available triggers:
# traceon traceoff snapshot stacktrace enable_event disable_event

Thanks,
Namhyung


> + seq_printf(m, " %s", p->name);
> + seq_putc(m, '\n');
> + mutex_unlock(&trigger_cmd_mutex);
> + return 0;
> + }
>
> data = list_entry(v, struct event_trigger_data, list);
> data->ops->print(m, data->ops, data);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/