Re: Question about /proc/uptime

From: Oleg Nesterov
Date: Fri Dec 27 2013 - 09:44:28 EST


Add Frederic, I am not sure I understand this correctly.

On 12/25, Rob Landley wrote:
>
> There are two values here, the first is seconds since boot time (which
> is just elapsed time; at one point it was ajusted for suspend and that
> was revered as confusing).

Hmm, uptime_proc_show() still uses get_monotonic_boottime(), this should
include suspend time?

> The second value isn't documented but looking at fs/proc/uptime.c I
> think it's idle time?

And this cpustat[CPUTIME_IDLE] doesn't match get_idle_time(), I guess
it only counts ticks.

> Except, if yo uadd up the idle time from all
> processors wouldn't you get 4x the uptime on a 4-way SMP system that's
> been idle since boot?

Yes, looks strange.

> Also, is this actual "cpu was on but not doing anything" time, so
> doesn't count suspend as idle?

I think suspend is not counted as idle.

> Confused,

I guess the 2nd value is historical, probably you should use /proc/stat.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/