Re: cpu consumption calculation - why these difference ?

Pavel Machek (pavel@atrey.karlin.mff.cuni.cz)
Thu, 20 May 1999 12:15:12 +0200


Hi!

> I've got one question about how the cpu consumption is calculated.
>
> Bellow are two programs that do the same thing, play stuff to the soundcard.
> The first uses a blocking write, the second a nonblocking one with a select.
> The select does not block (if it did, the cpu consumption is reported to
> be the same than the first method, both by ps and top). It does an
> usleep(10*1000) if there is no space left in the audio buffers.
>
> My question is : why does the first get 5% of cpu consumption reported
> by both ps and top when the second gets only 0.1% ? They both do the same
> calculations, so it should be equal, nope ? Is it related to the kernel
> or just the ps and top programs ? (Is it only a problem ?)

Kernel cpu meters do not work too well, see may badboy examples and
discussion around them. I even have patch, somewhere... Search archives.

Pavel

-- 
The best software in life is free (not shareware)!		Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/