Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Top values don't add up
Date: Tue, 19 Aug 2008 13:23:15
Message-Id: 200808191522.20791.alan.mckinnon@gmail.com
In Reply to: [gentoo-user] Top values don't add up by "Håkon Alstadheim"
1 On Tuesday 19 August 2008 15:02:34 Håkon Alstadheim wrote:
2 > Top reports ~70% idle, while at the same time the topmost couple of
3 > processes are reported as using >70%CPU. Is there anything I could use
4 > that reports more sensible values ?
5 >
6 > I'm running the machine for multi-media-use, and I would like to make
7 > sure that I tune the media-programs to leave sufficcient cpu to handle
8 > the odd house-keeping task, while at the same time doing as much
9 > post-processing for image and sound quality as possible. Is there a way
10 > to get top to make sense, or are there other tools you good people would
11 > recommend ?
12
13 Let the kernel do what it does best - scheduling. You stay away from this as
14 this is the one thing you do worst. Unless you have some weird workload it is
15 highly unlikely that you will even remotely approach the kernel's choices for
16 scheduler efficiency, much less better them.
17
18 The kernel is designed to give every process a fair shot at running, this is a
19 process that requires millions of decisions a second.
20
21 The reason that top's output does not add up is that top (plus free and most
22 of the contents of /proc as well) is basically lying through it's teeth. All
23 these tools read the various files in /proc to get their data. By the time top
24 has read the last file it wants, the ones before it have changed many
25 thousands of times over. So basically you get a snapshot view of what the
26 system is averaging, and you are not interested in the exact number you see on
27 the screen (because you can't trust it), but you are interested in the general
28 trend over time (as you can trust that)
29
30 --
31 alan dot mckinnon at gmail dot com