Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events

From: Wangnan (F)
Date: Fri Apr 08 2016 - 12:16:58 EST




On 2016/4/8 23:22, Arnaldo Carvalho de Melo wrote:
Em Fri, Apr 08, 2016 at 03:07:22PM +0000, Wang Nan escreveu:
Before this patch, strange error message is provided if passed a
non-tracepoint event to 'perf trace':

# perf trace -a --ev cycles sleep 1
Failed to set filter "common_pid != 27500" on event cycles with 22 (Invalid argument)

This is because 'perf trace' accepts all valid events during cmdline
parsing, but in fact user can only provide tracepoints, because it
needs filter.

This patch validate evlist, report error earlier:

# ./perf trace -a --ev cycles sleep 1
Only support tracepoint events!
Humm, perhaps we should instead refrain from setting filters to non
tracepoint events? I.e. I don't see why we whouldn't support, say,
software events...

/me trying some now, i.e.:

# trace --ev minor-faults --no-syscalls

But it has some issues...

- Arnaldo

We already have commit fdf14720fbd02 ("perf tools: Only set filter for
tracepoints events") so you won't see the ugly error message again.

However, I think parsing non-tracepoint events in 'perf trace' is still
a challange. We never support it in 'perf trace' and I'm not too much
sure who will need this feature and how to use them, and why he/she can't
use 'perf record' instead.

Thank you.