Re: Weird behaviour on /proc/stat

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Sven Wegener
Date: Wednesday, August 6, 2008 - 2:51 pm

On Wed, 6 Aug 2008, Rafael C. de Almeida wrote:


It's expected behaviour, but it is indeed misleading. Here's the reason 
why it happens: In the kernel we're accounting time based on CONFIG_HZ 
(which I suspect is 1000 in your case) but are exporting values based on 
USER_HZ (100, historic reasons) to userspace. So we're effectively 
dividing the values by 10. Well, that division obviously leaves a 
remainder in most cases, which is dropped. You see in the code that for 
the summary we first add all in-kernel values up and then do the 
conversion (cputime64_to_clock_t) to userspace values. So we're actually 
adding up all the remainders, which we drop when converting each per-cpu 
data on its own. This leads to a couple of additional jiffies being 
accounted in the summary.

Sven
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Weird behaviour on /proc/stat, Rafael C. de Almeida, (Wed Aug 6, 1:35 pm)
Re: Weird behaviour on /proc/stat, Sven Wegener, (Wed Aug 6, 2:51 pm)