Re: [PATCH 01/24] perf tools: Add a test for tracking with sched_switch

From: Adrian Hunter
Date: Fri Aug 29 2014 - 09:55:49 EST

On 08/20/2014 10:48 PM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Aug 15, 2014 at 10:08:36PM +0300, Adrian Hunter escreveu:
>> Add a test that checks that sched_switch events and
>> tracking events can be recorded for a workload using the
>> evsel->system_wide and evsel->tracking flags (respectively)
>> with other events sometimes enabled or disabled.
> Really nice exercise! Gives lots of evlist/evsel routines a good test,
> checking for expected behaviour, really good, thanks.
> One thing I noticed was that it uses parse_events() for creating events,
> a perhaps simpler equivalent would be:
> switch_evsel = perf_evsel__newtp("sched", "sched_switch");
> And then go on, like you did, configuring whatever attribute one wants
> to have set, like what you get from ":u", and the other things you
> touched, like:
> switch_evsel->system_wide = true;
> switch_evsel->no_aux_samples = true;
> switch_evsel->immediate = true;
> And when the evsel is all set up, if dealing with evlists, like in this
> case, just do a:
> perf_evlist__add(evlist, switch_evsel);
> Looks more natural than using parse_events(evlist, "sched:sched_switch");
> To then infer that it must be the last entry at this point to retrieve
> it using:
> switch_evsel = perf_evlist__last(evlist);
> But, for the current architecture, that should be just a clarification,
> not a requirement for this specific test.

I will keep that in mind.

> Applying!

Thank you!

AFAICT the other 20 patches still apply cleanly to your tree, so I am not
going to send any more for now.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at