Skip to contentSkip to conversation

what should 'uptime' be on suspend?

RFC Bill Davidsen 5 participants 10 messages Jul 20, 2007 – Jul 25, 2007

lore
Share & tools
lore
#0 lore raw

I just found a machine which will resume after suspend to memory, using the mainline kernel (no suspend2 patch).

On resume I was looking at the uptime output, and it was about six minutes, FAR longer than the time since resume. So the topic for discussion is, should the uptime be
- time sine the original boot
- total uptime since first boot, not counting the time suspended
- time since resume
- some other time around six minutes

Any of the first three could be useful and "right" for some casesm thus discussion invited.

Signature · 3 lines
Bill Davidsen <[email protected]>
 "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot
#1 lore raw
Quoted 11 lines · Bill Davidsen

I just found a machine which will resume after suspend to memory, using the mainline kernel (no suspend2 patch).

On resume I was looking at the uptime output, and it was about six minutes, FAR longer than the time since resume. So the topic for discussion is, should the uptime be
- time sine the original boot
- total uptime since first boot, not counting the time suspended
- time since resume
- some other time around six minutes

Quoted 3 lines

Any of the first three could be useful and "right" for some casesm thus discussion invited.

My ibook has always been able to suspend to RAM. For a long while,
uptime was shown as the time since the last boot. At some point, maybe about a year ago, this was "corrected" to show time since boot _less_ time suspended.

To be clear, the ibook suspends when I close the lid and resumes
when I open it. Uptime used to be convenient, because I could work out when I'd last booted.

Ken

Signature · 1 line
das eine Mal als Tragödie, das andere Mal als Farce
#2 lore raw
Quoted 15 lines · On Fri, 20 Jul 2007 18:17:29 +0100 Ken Moffat wrote:
Quoted 11 lines · Bill Davidsen

I just found a machine which will resume after suspend to memory, using the mainline kernel (no suspend2 patch).

On resume I was looking at the uptime output, and it was about six minutes, FAR longer than the time since resume. So the topic for discussion is, should the uptime be
- time sine the original boot
- total uptime since first boot, not counting the time suspended
- time since resume
- some other time around six minutes

Quoted 3 lines

Any of the first three could be useful and "right" for some casesm thus discussion invited.

Quoted 8 lines

My ibook has always been able to suspend to RAM. For a long while,
uptime was shown as the time since the last boot. At some point, maybe about a year ago, this was "corrected" to show time since boot _less_ time suspended.

To be clear, the ibook suspends when I close the lid and resumes
when I open it. Uptime used to be convenient, because I could work out when I'd last booted.

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is suspended, so the suspension time should not be included in uptime.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#3 lore raw
Quoted 7 lines · Randy Dunlap

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is suspended, so the suspension time should not be included in uptime.

So, maybe I shouldn't have put corrected in inverted commas,
because this was a real correction and my previous usage was an unintended side-effect of an error.

Anyway, the current behaviour is known and I guess any attempt to
change it (e.g. to what Bill was expecting) won't be well received.

Ken

Signature · 1 line
das eine Mal als Tragödie, das andere Mal als Farce
#4 lore raw
Quoted 8 lines · Ken Moffat
Quoted 7 lines · Randy Dunlap

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is suspended, so the suspension time should not be included in uptime.

Quoted 6 lines

So, maybe I shouldn't have put corrected in inverted commas,
because this was a real correction and my previous usage was an unintended side-effect of an error.

Anyway, the current behaviour is known and I guess any attempt to
change it (e.g. to what Bill was expecting) won't be well received.

I agree.

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#5 lore raw
In reply to Ken Moffat
Quoted 9 lines · Ken Moffat
Quoted 7 lines · Randy Dunlap

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is suspended, so the suspension time should not be included in uptime.

Quoted 7 lines

So, maybe I shouldn't have put corrected in inverted commas,
because this was a real correction and my previous usage was an unintended side-effect of an error.

Anyway, the current behaviour is known and I guess any attempt to
change it (e.g. to what Bill was expecting) won't be well received.

So is setting it to a random number considered correct behavior? Any of the first three values I mentioned would make sense, but the value I see is neither time since resume, time since power-on to do the resume, or any of the logical uptime values. That was the whole point of the original post, the uptime reported makes no sense at all.

Signature · 3 lines
bill davidsen <[email protected]>
 CTO TMR Associates, Inc
 Doing interesting things with small computers since 1979
#6 lore raw
Quoted 7 lines · Bill Davidsen

So is setting it to a random number considered correct behavior? Any of the first three values I mentioned would make sense, but the value I see is neither time since resume, time since power-on to do the resume, or any of the logical uptime values. That was the whole point of the original post, the uptime reported makes no sense at all.

I assumed you had booted for a short time, suspended, resumed, and
then noticed the uptime was longer than time since resume.

If you think there is a bug it might help to do a cold boot, at
some point note uptime and then immediately suspend, resume some time later, immediately note uptime (including local time), keep it running, and later monitor uptime against local time (i.e. the local time will let you know the change you expect to see in uptime). You might also want to confirm that the local time is maintained correctly.

Ken

Signature · 1 line
das eine Mal als Tragödie, das andere Mal als Farce
#7 lore raw
Quoted 8 lines · Ken Moffat
Quoted 3 lines · Bill Davidsen

So is setting it to a random number considered correct behavior? Any of the first three values I mentioned would make sense, but the value I see is neither time since resume, time since power-on to do the resume, or any of the logical uptime values. That was the whole point of the original post, the uptime reported makes no sense at all.

I assumed you had booted for a short time, suspended, resumed, and
then noticed the uptime was longer than time since resume.

Quoted 8 lines

If you think there is a bug it might help to do a cold boot, at
some point note uptime and then immediately suspend, resume some time later, immediately note uptime (including local time), keep it running, and later monitor uptime against local time (i.e. the local time will let you know the change you expect to see in uptime). You might also want to confirm that the local time is maintained correctly.

I resumed this morning, uptime before the suspend was ~4 hours, suspend time was ~30 hours, resume took 76 sec from power-on, uptime was 2m56s. As originally noted, the first time I did this the "uptime" after resume was 6+min. First noted on suspend to ram, this was suspend to disk to see if that changed anything.

Just an oddity, I guess if I care I can track it myself.

Signature · 3 lines
bill davidsen <[email protected]>
 CTO TMR Associates, Inc
 Doing interesting things with small computers since 1979
#9 lore raw
In reply to Randy Dunlap

Hi!

Quoted 23 lines
Quoted 14 lines
Quoted 11 lines

I just found a machine which will resume after suspend to memory, using the mainline kernel (no suspend2 patch).

On resume I was looking at the uptime output, and it was about six minutes, FAR longer than the time since resume. So the topic for discussion is, should the uptime be
- time sine the original boot
- total uptime since first boot, not counting the time suspended
- time since resume
- some other time around six minutes

Quoted 3 lines

Any of the first three could be useful and "right" for some casesm thus discussion invited.

Quoted 8 lines

My ibook has always been able to suspend to RAM. For a long while,
uptime was shown as the time since the last boot. At some point, maybe about a year ago, this was "corrected" to show time since boot _less_ time suspended.

To be clear, the ibook suspends when I close the lid and resumes
when I open it. Uptime used to be convenient, because I could work out when I'd last booted.

Quoted 5 lines

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is suspended, so the suspension time should not be included in uptime.

Well. I claim that the system is not running when cpu is in hlt.

...and on some weird machines (openmoko, olpc) they have hardware capable of suspending most of machine between keypresses. Now, PCs are not there yet, but sooner or later we will sleep/suspend between keypresses.

It is not worth changing now, but at least runtime suspend should be accounted as 'running'.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw
In reply to Bill Davidsen
Quoted 25 lines · Bill Davidsen
Quoted 18 lines · Ken Moffat
Quoted 9 lines · Randy Dunlap

man uptime:
uptime - tell how long the system has been running

I claim that the system is not running when it is
suspended,
so the suspension time should not be included in
uptime.

So, maybe I shouldn't have put corrected in inverted commas,
because this was a real correction and my previous usage was an
unintended side-effect of an error.

Quoted 5 lines

Anyway, the current behaviour is known and I guess any attempt to
change it (e.g. to what Bill was expecting) won't be well received.

Quoted 7 lines

So is setting it to a random number considered correct behavior? Any of the first three values I mentioned would make sense, but the value I see is neither time since resume, time since power-on to do the resume, or any of the logical uptime values. That was the whole point of the original post, the uptime reported makes no sense at all.

Ouch, seems like something is wrong with timer subsystem. Can you verify that rest of the clock machinery behaves ok?

We do manual correction of uptime during resume (IIRC) - perhaps something goes wrong there?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html