I’ve been trying to find a way to detect when a particular thread is running on a CPU and when it is not. Ideally, I’d like to hook in directly to the kernel to keep track of when my thread is scheduled, when it yields, and when it is interrupted by a context switch. Is there any off the shelf tool that can report this information accurately?
Share
You want ‘perf sched’ utility, or if running an older kernel, ‘ftrace’.
‘perf sched’ has five sub-commands currently:
perf sched {record|latency|map|replay|script}
http://lwn.net/Articles/353295/