Re: [PATCH 3/3] perf, tool: Add new event group management

From: Peter Zijlstra
Date: Tue Mar 20 2012 - 14:45:06 EST


On Tue, 2012-03-20 at 19:15 +0100, Jiri Olsa wrote:
> Examples (first event in brackets is group leader):
>
> # 1 group (cpu-clock,task-clock)
> perf record --group -e cpu-clock,task-clock ls
> perf record --group parsed -e cpu-clock,task-clock ls
>
> # 2 groups (cpu-clock,task-clock) (minor-faults,major-faults)
> perf record --group parsed -e cpu-clock,task-clock \
> -e minor-faults,major-faults ls
>
> # 1 group (cpu-clock,task-clock,minor-faults,major-faults)
> perf record --group -e cpu-clock,task-clock \
> -e minor-faults,major-faults ls
>
> # 2 groups (cpu-clock,task-clock) (minor-faults,major-faults)
> perf record --group parsed -e cpu-clock,task-clock \
> -e minor-faults,major-faults -e instructions ls
>
> # 1 group (cpu-clock,task-clock,minor-faults,major-faults,instructions)
> perf record --group -e cpu-clock,task-clock \
> -e minor-faults,major-faults -e instructions ls

I can't help but dislike the --group/--group parsed thing...

How about something like:

event_group = "{", events, "}" , [ ":", event_group_mod ]

Such that you can write things like:

perf record -e "{cpu-clock,cache-misses,cache-references}"

perf stat -e "{cpu-clock,cycles},{cpu-clock,cache-misses,cache-references}"
perf stat -e "{cpu-clock,cycles}" -e "{cpu-clock,cache-misses,cache-references}"

I'm not sure what the current behaviour of --group is, if you create a
group like this, do they all sample?

If so, we need some option like:

perf record -e "{cpu-clock,cache-misses,cache-references}:1"

to mean, only sample on cpu-clock but use PERF_SAMPLE_READ and
PERF_FORMAT_GROUP to read all siblings on every cpu-clock sample.

Now the disadvantage is that {} needs quotes on bash, the advantage is
that its completely natural on how to construct groups, without weird
--group/--group parsed. Also it provides a place for group modifiers.
--
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/