Notify the user if a filter is already enabled
authorChristian Babeux <christian.babeux@efficios.com>
Fri, 24 Aug 2012 02:05:12 +0000 (22:05 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 24 Aug 2012 18:22:32 +0000 (14:22 -0400)
commit7671f53cf3b6029a3bf00e502a0a58ac7a82e378
treea9bc0b0a7a87a4ad0308aa8876376bd76941c31c
parent03b1319df1a6c74a152d4723bf1bf9e1cdf770e1
Notify the user if a filter is already enabled

When using the enable-event command in conjunction with the --filter
option, a user can specify a filter expression to refine the trace
output.

As stated in the lttng(1) man page, only the first activation of a
filter on an event will work. Subsequent activation of any filter
expression on the same event will fail.

e.g:

> lttng enable-event app:tp -s session -u --filter 'somefield > 42'

Case: invalid filter expression
> lttng enable-event app:tp -s session -u --filter 'invalid expression'
  Error: Error setting filter
  Warning: Some command(s) went wrong

> ...

Case: filter already enabled for event app:tp
> lttng enable-event app:tp -s session -u --filter 'someotherfield < 42'
  Error: Error setting filter
  Warning: Some command(s) went wrong

This commit differentiate the case where a filter was already set for
the specified event from the generic 'Error setting filter' error
message.

e.g:

> lttng enable-event app:tp -s session -u --filter 'somefield > 42'

Case: invalid filter expression
> lttng enable-event app:tp -s session -u --filter 'invalid expression'
  Error: Error setting filter
  Warning: Some command(s) went wrong

> ...

Case: filter already enabled for event app:tp
> lttng enable-event app:tp -s session -u --filter 'someotherfield < 42'
  Error: Filter on event app:tp is already enabled (channel 0, session session)
  Warning: Some command(s) went wrong

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/enable_events.c
This page took 0.025028 seconds and 4 git commands to generate.