Re: [PATCH V2 12/15] perf tools: allow non-matching sample types

From: Adrian Hunter
Date: Mon Jul 01 2013 - 05:26:48 EST


On 27/06/13 19:39, David Ahern wrote:
> On 6/27/13 1:55 AM, Adrian Hunter wrote:
>> Sample types need not be identical to determine
>> the sample id from the event. Only the position
>> of the sample id needs to be the same.
>>
>> Compatible sample types are ones in which the bits
>> defined by PERF_COMPAT_MASK are the same.
>> 'perf_evlist__config()' forces sample types to be
>> compatible on that basis.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
>> ---
>> tools/perf/builtin-report.c | 2 +-
>> tools/perf/util/event.h | 14 +++++
>> tools/perf/util/evlist.c | 135
>> ++++++++++++++++++++++++++++++++++++++++++--
>> tools/perf/util/evlist.h | 8 ++-
>> tools/perf/util/evsel.c | 64 ++++++++++++++++++++-
>> tools/perf/util/evsel.h | 10 ++++
>> tools/perf/util/session.c | 8 ++-
>> 7 files changed, 230 insertions(+), 11 deletions(-)
>>

Snip

>
> While this works for a combined S/W and tracepoint events session, I do not
> like promoting sample types to the minimum compatible level for all events
> in the session. perf needs to allow each event to have its own sample_type
> and not force a minimal compatibility.

Why? The impact is small. The kernel API is completely unchanged.

Consider the affected sample members:

PERF_SAMPLE_IP
PERF_SAMPLE_TID
PERF_SAMPLE_TIME
PERF_SAMPLE_ADDR
PERF_SAMPLE_ID
PERF_SAMPLE_CPU
PERF_SAMPLE_STREAM_ID

Of those, perf_evlist__config() always selects PERF_SAMPLE_IP,
PERF_SAMPLE_TID and PERF_SAMPLE_ID, and never selects PERF_SAMPLE_STREAM_ID.
That leaves just:

PERF_SAMPLE_TIME
PERF_SAMPLE_ADDR
PERF_SAMPLE_CPU

PERF_SAMPLE_TIME is always selected when inheriting.

PERF_SAMPLE_TIME and PERF_SAMPLE_CPU are always selected for per-cpu recording.

Under what circumstances would you want 'time' and/or 'cpu' on some events
but not all of them?

Under what circumstances would you want 'addr' but those events are not the
vast majority of the events you record?

--
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/