sysprof, interrupting threads
jhb at freebsd.org
Wed Nov 2 07:16:42 PST 2005
On Wednesday 02 November 2005 04:37 am, Viktor Vasilev wrote:
> Hello fellow hackers,
> I was thinking of porting the linux sysprof kernel and userland tools
> to FreeBSD. I spent some time studying the code and wrote a skeleton
> driver that uses the callout mechanism to wake up periodically. That
> was only to discover, that the context in which the driver awakes is
> that of the software clock interrupt.
> The linux sysprof driver uses a timer hook API that was introduced in
> the 2.6 kernel series. I don't have a profound understanding of the
> linux kernel but it seems that the hook gets executed in the process
> context that was currently executing as the tick happened.
> My question is, is there a better place to plant the code, so that it
> executes periodically in the context of the current runnging thread?
> I was also thinking of traversing the list of processes but I'm not
> sure if I can tell which one was interrupted by the swi.
> Any suggestions are wellcome.
hardclock_process() and statclock_process() (poorly named, should really be
s/process/thread/ at this point). I believe kernel gprof profiling is done
in statclock_process for example.
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-hackers