Date: Wed, 2 Nov 2005 09:53:43 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Viktor Vasilev <viktor.vasilev@stud.tu-darmstadt.de> Subject: Re: sysprof, interrupting threads Message-ID: <200511020953.44298.jhb@freebsd.org> In-Reply-To: <20051102093702.GB624@ilium.0xdeadc0de.net> References: <20051102093702.GB624@ilium.0xdeadc0de.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511020953.44298.jhb>