[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`time' command displays wrong %CPU
From: |
Sven Sandberg |
Subject: |
`time' command displays wrong %CPU |
Date: |
Tue, 05 Feb 2002 19:06:01 +0100 |
Hello,
I'm using time version 1.7 on Linux Mandrake. It once gave me the
result:
45157.79user 3.50system 12:33:11elapsed 4%CPU (0avgtext+0avgdata
0maxresident)k 0inputs+0outputs (1760major+15244minor)pagefaults 0swaps
In the manpage, it says that %CPU is calculated as
(user+system)/elapsed. So the printed CPU usage is wrong, it should be
99.9%. This could be explained by the internal time being represented as
microseconds in a >32 bit int, but when calculating the %CPU it
truncates it to 32 bit unsigned at some step. If this is true, it
probably also just truncates the result rather than round it towards the
nearest integer (though this might be more a matter of taste than a
bug). (Sorry if this is a known or fixed bug, but I couldn't find any
bug list.)
--
Sven Sandberg address@hidden home.student.uu.se/svsa1977
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- `time' command displays wrong %CPU,
Sven Sandberg <=