This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Instrumenting context-switching
Mike Mason wrote:
> The scheduler tapset probes context_switch() on x86_64, but that doesn't
> help much. context_switch() is an inline and, thus, the entry parameters
> prev and next aren't accessible via SystemTap.
You can still effectively get prev and next if you use a pair of probes.
A probe at the beginning of context_switch is still on the old thread,
so current == prev. A probe on finish_task_switch is in the context of
the new thread, so current == next. You can access various fields in
current by using the context.stp tapset, or use task_current() to get
the actual task_struct pointer.
These functions are used for scheduler.cpu_off and scheduler.cpu_off,
since they are architecture-independent locations in the scheduler.
Josh