Subject: Re: correctly counting user/sys/interrupt time
To: None <tech-kern@netbsd.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 04/08/2006 13:52:03
David Laight wrote:
> I'm doing some experiments using the cpu's cycle-counter to count
> the time spent inside system calls (per system call).
> This works, and gives some quite informative numbers...
> 
> This seems to be almost enough information to do non-statistical
> user/system/interrupt time for a process.

I've been thinking of doing that for powerpc.

> However to do the job properly I need to add instumentation to the
> interrupt and trap/fault entry/exit points.  Whereas the code in syscalls.c
> is quite simple (i386), that in trap.c seems to have more exit-points
> than I've had hot dinners.... and I'm not even sure hardware interrupts
> go through that code at all.
> 
> Is there a reasonable place to intercept traps and hardware interrupts ?
> Where does the process preemption on interrupt happen ?

Exactly where and what are you counting?  Do you add members to lwp's l_md
struct?  I assume you've added stuff to cpu_info as well.

It would be nice if those systems with cycle counters could also similar
approaches.

-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this message.