sysprof, interrupting threads

Viktor Vasilev viktor.vasilev at stud.tu-darmstadt.de
Wed Nov 2 01:37:12 PST 2005


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.


Best regards,
Viktor
-- 
I think and think for months and years. Ninety nine times, the
conclusion is false. The hundredth time I am right.
                               -- Albert Einstein



More information about the freebsd-hackers mailing list