Re: Determining idleness when auto-suspending



On Wed, 2007-11-14 at 16:12 +0000, Odysseus Flappington wrote:
> Hi all,
> I'm following up an issue I brought up a while ago regarding
> 'auto-suspending' the computer when idle. My argument was that there
> are too many false-positives when determining the computer is idle
> because it is solely up to each application to inhibit the OS from
> suspending when in use
> (https://wiki.ubuntu.com/GnomePowerManagerInhibitSpec). This in turn
> causes the computer to sleep while it's actually in use, and
> happens on many occasions barring when it actually detects kb/mouse
> input. 

Sure.

>  Perhaps, querying a device for power-state is a way to determine
> whether it's in use or not, however, I am more concerned with the need
> to query devices for activity whether or not it's through its
> power-state or not. 
> 
We can't poll, it uses lots of power.
> 
> In turn, my thoughts keep going back to having a userspace application
> (GPM?) query each device on the system for activity, and then
> inhibiting the OS from suspending when it finds a device is active. 

Well, then you need to make all applications "query-able" - you can't
query devices at that's not a fair state of the system

> Obviously, I don't think that this has to specifically include all
> devices that make up a system. For instance, checking the graphics
> card to see whether it's in use would be useless since a screensaver
> could be using it while the computer is idle. However, if data being
> transferred through the network interface, then I should think it's
> safe to say that the computer isn't idle

I don't think this is correct - liferea could be downloading new rss
feeds or PackageKit downloading updates; both of these can be
interrupted (and should be) to suspend on battery while idle.

> I would at least think things like the hard-drive, network interfaces,
> audio devices, firewire, pc cards and usb devices can be queried at
> all times to see if they're in use and effectively allow the OS to
> automatically determine whether the computer can be suspended or not. 

Err, no polling allowed. It all has to be async.

> To conclude, I know that querying block devices (i.e. the hard-drive)
> for activity is a pretty trivial thing (by checking certain files
> in /sys).

That's a horrible thing to do - it's just like kpowersave having a
blacklist of applications so that if a process called "mplayer" is
running then it won't autosuspend. Not nice.

> If querying other devices on a system is just as easy, would we not be
> interested in coming up with a mechanism to automate determining when
> the computer is idle? For what reasons are we not looking into this
> kind of solution? If it's possible, it seems like it would be a much
> more elegant solution than putting the ownus on every single developer
> that wants to write an app that will work in Gnome. 

No. Say you are writing a CD-Writer application. You only want to
prevent suspending when actually writing the disk, not when you are
choosing files and then get called away by the doorbell.

What I'm trying to say is that only the application knows itself what is
a good idea and what isn't - guessing based upon some heuristic is not a
good idea in my opinion. If you want something that does do heuristics,
have a look at OHM, although that is targeted mainly to embedded stuff
like OLPC.

Richard.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]