tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getrusage() problems with user vs. system time reporting



On Mon, Oct 31, 2011 at 10:38:33PM +0100, Joerg Sonnenberger wrote:
> On Mon, Oct 31, 2011 at 09:10:40PM +0000, David Laight wrote:
> > The problem is that getting an accurate timestamp is relatively
> > expensive. It has been almost the dominant part of process switch.
> 
> Let's make this a bit less vague for X86. The numbers are from memory,
> but should reflect the order of magnitude. Using TSC or LAPIC for
> gettimeofday requires in the order of 100-120 cycles, including system
> call overhead. Timer code is roughly half of that. Any other timer,
> including HPET and ACPI-fast are above the 1000 cycle barrier and
> completely inacceptable.

This is in-kernel so the system call overhead doesn't matter.

If you look at sys/sys/syscall_stats.h and build a kernel with
option that enable SYSCALL_TIMES_PROCTIMES then the TSC values
get added into the timer interrupt counts are are then used to
split the total execution time much more accurately.

I'm not sure the code hasn't bitrotted since I wrote it!

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index