Re: [PATCH] trace: add ability to set a target task for events

From: Andrey Wagin
Date: Tue Jul 10 2012 - 15:51:25 EST


Hello Peter,

2012/7/10 Peter Zijlstra <peterz@xxxxxxxxxxxxx>:
> On Wed, 2012-07-04 at 13:08 +0400, Andrew Vagin wrote:
>> From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
>>
>> A few events are interesting not only for a current task.
>> For example, sched_stat_* are interesting to a task, which
>> wake up. For this reason, it will be good, if such events will
>> be delivered to a target task too.
>>
>> Now a target task can be set by using __perf_task().
>
> Right, I suspect you actually tested this and it works?

Yes, of course I did.

>
> It would be good it you can expand the Changelog a bit to include your
> entire use-case.
Ok, I'm going to send a new version of this patch with your comments.

> IIRC you're wanting to measure task block latency and
> need the time and place where it goes to sleep, provided by
> trace_sched_switch + callchain, and the time when it gets woken up,
> provided by trace_sched_wakeup().

Actually sched_stat_* contains a time period for which a task slept.

Now for profiling sleep times we need to do following actions:
* Collect sched_switch and sched_stat_sleep events
# ./perf record -e sched:sched_stat_sleep -e sched:sched_switch -gP -o
perf.data.raw ~/foo
* We need to combine sched_switch and sched_stat_sleep events.
sched_switch contains a callchain and sched_stat_sleep contains a time
period. I taught perf-inject to do that. It sets a period from
sched_stat_sleep to a proper sched_switch.
# ./perf inject -v -s -i perf.data.raw -o ./perf.data

>
> Hmm.. you only add __perf_task() to sched_stat_template, should it also
> be added to sched_wakeup_template?

Yes, it can be added. It may be useful for someone else.

>
> ISTR us talking about dis-allowing callgraphs on such cross-task events,
> since that would be nigh impossible to interpret, right?
>
> So do we want something like this on top?

Yes, you are right and I checked your code, it works fine. Thanks a
lot for comments.

If someone wants to try out my patches, he can clone the branch
"prof-D-state" from it git://github.com/avagin/perf.git
--
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/