Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am curious as to why I am getting an incorrect Idle Time from the /proc/uptime on my server.

Output of cat /proc/uptime from my server:

$> cat /proc/uptime:
1218960.08 15958635.85

$> uptime:
14:15:45 up 14 days,  2:36,  1 user,  load average: 6.22, 6.01, 6.15

As you can see, the uptime reported from /proc/uptime and uptime commands match. I am interested in the Idle Time though (the second parameter reported from /proc/uptime). I understand that the Idle time gets cumulated for each cpu on the server. However, even accounting for all the cpus reported, the IDLE time is still exceeding UPTIME. Converting the output from /proc/uptime to readable time:

$> echo "1218960.08" | awk '{printf("%d days, %02d:%02d:%02d",  int($0/86400), int(($0%86400)/3600), int(($0%3600)/60), int($0%60))}'
14 days, 02:36:00

$> echo "15958635.85" | awk '{printf("%d days, %02d:%02d:%02d",  int($0/86400), int(($0%86400)/3600), int(($0%3600)/60), int($0%60))}'
184 days, 16:57:15

My server is an Amazon cloud EC2 instance (C1XL) which has 8 logical cores (also reported so by these commands:

$> cat /proc/cpuinfo | grep processor | wc -l
8

$> lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    1
Core(s) per socket:    1
CPU socket(s):         8
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               1799.999
BogoMIPS:              3599.99
Hypervisor vendor:     Xen
Virtualization type:   para
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              20480K
NUMA node0 CPU(s):     0-7

Given this, the IDLE time (even at 100% idle state) should not have exceeded 9751680.64 seconds (112 days, 20:48:00). Any pointers as to why the IDLE time is being reported wrong?

Btw, I looked for "physical id" and "siblings" in the /proc/cpuinfo output and these were not present; hence me using the count of Processor lines.

share|improve this question
add comment

1 Answer

On my idle dual-core workstation the second number increases twice as fast as the first number -- as it should.

On an AWS instance with 2 virtual cores, idle, the second number increases 4 times as fast. The AWS instance is started from an official Ubuntu image.

So for some reason your machine records idle time as if it had 16 cores.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.