Strange CPU usage times with SMP

Chris Griffin (boozer@vanadium.rollins.edu)
Fri, 10 Jan 1997 22:25:06 -0500 (EST)


I have been running some fairly demainding programs on my Dual PPro 200
linux box lately and it is great! I am using calles to times() to try to
get CPU time usage so I can benchmark it against some other platforms I
work on. The only problem is that when SMP is enabled I get some fairly
strange times. Sometimes all the time will be system time, other times
it will all be user time, and as you might have guessed, all combinations
in-between. If I run this program 5 times, I will get 5 different
combinations, but they will always add up to the same number Even stranger,
when I run 2 programs at once, and then look at the output with top, the
USER CPU is 99% and the system CPU is at 101%. I assume this has to do
with the fact that I have 2 processors TICKing away. Is this a bug in
the kernel, C libraries, or just an eventuality that hasn't been taken
care of yet? In the mean time, does anyone know a way to fix this
behavior? I am using gcc2.7.2, libc5.3.12, procps 1.01 and linux 2.0.27.

Thanks a lot!
Chris