We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Is it possible to know how much time phone in idle state (screen off)?

asked 2015-10-25 08:41:40 +0300

Schturman gravatar image

updated 2015-10-25 11:08:16 +0300

Is it possible to somehow calculate the screen off time ?
I mean I need terminal command.
I can check if screen off/on or locked/unlocked now, but don't know how much it was off...
Thanks

edit retag flag offensive close delete

Comments

Maybe sysmon? (https://openrepos.net/content/basil/system-monitor)

objectifnul ( 2015-10-25 09:44:59 +0300 )edit

Haven't looked at the source, but perhaps this could help?

pichlo ( 2015-10-25 10:20:29 +0300 )edit

Ohhh, sorry... my mistake. I meant how to check with terminal command. I will update question.

Schturman ( 2015-10-25 11:04:43 +0300 )edit

I did not know you meant 'from the terminal' but I did read your question as 'how to check it programmatically'. The screen usage monitor source may help but I would need to get back home and spend some time checking the source to see if any of that is usable directly from the command line, without any extra tools.

You say you can tell if the screen is on or off. So as a last resort, you can keep a log of changes and calculate the time yourself. It may not be very accurate, depending on how quickly you detect the change.

pichlo ( 2015-10-25 12:45:39 +0300 )edit
1

thanks, I'm already trying to find this from source in your link. For now without result...
And yes, calculating by myself is not accurate because my checking script work every 20-30min.

Schturman ( 2015-10-25 13:42:49 +0300 )edit

1 Answer

Sort by » oldest newest most voted
4

answered 2015-10-29 11:04:45 +0300

spiiroin gravatar image

Currently display state statistics are not collected (anymore - back in Nokia N9 times display on time had to be tracked to compensate for amoled display aging).

But if you wish to know how long the device has been suspended (= can be used as upper bound for display off time estimate), you can use "mcetool --get-suspend-stats" (will be available in mce >= 1.65.0 / sfos >= 2.0.1).

Note that the above is just an abstraction for the benefit of automated testing. You can get the same data already now by using clock_gettime() and calculating difference between CLOCK_BOOTTIME (which accounts also time spend in suspend) and CLOCK_MONOTONIC (which does not advance when device suspends).

edit flag offensive delete publish link more

Comments

Thank you...

Schturman ( 2015-10-29 13:59:03 +0300 )edit

Turns out also autotesting could benefit from having access to accurate display state statistics, so I added a ticket for making it possible to query data from mce via D-Bus / mcetool.

Details at: https://bugs.merproject.org/show_bug.cgi?id=1401

spiiroin ( 2015-11-03 12:18:30 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2015-10-25 08:41:40 +0300

Seen: 600 times

Last updated: Oct 29 '15