Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Serious power saving with dbus-scripts and pkill -STOP

    Reply
    Page 1 of 3 | 1   2     3   | Next
    Xagoln | # 1 | 2011-05-13, 17:27 | Report

    We all know that many processes run in the background constantly. Some of the worst offenders are:
    • scim-panel-gtk
    • browserd
    • tracker
    • image-viewer
    • ...

    dbus-scripts (see the excellent Maemo Wiki page) is a nifty tool to listen to internal system events and respond accordingly.

    Now, in catching the D-Bus messages for screen dimming and especially screen lock, we can 'pause' these processes using the standard Unix 'SIGSTOP' signal, meaning they shouldn't consume any CPU cycles/power until awoken.

    Some of you might question putting browserd in there, firstly because of dsme/watchdog, and secondly because you might be downloading something and lock the screen. The good news is that I found that dsme/watchdog will not trigger a reboot if browserd is paused. As long as it is in the process list, no probs. Re downloading, I'd probably use Opera in that case.

    Be sure you know what you're doing, or are prepared to reflash

    How it's done:

    As root:
    Code:
    $ root
    
    # apt-get install dbus-scripts
    Fīle: /etc/dbus-scripts.d/screen-lock
    Code:
    /usr/local/share/dbus-scripts/screen-lock   * * com.nokia.mce.signal tklock_mode_ind locked
    /usr/local/share/dbus-scripts/screen-unlock * * com.nokia.mce.signal tklock_mode_ind unlocked
    (The above should be two long lines, bear that in mind if it has word-wrapped into 4 or more)


    Fīle: /usr/local/share/dbus-scripts/screen-lock
    Code:
    #!/bin/ash
    
    for process in browserd scim-panel-gtk image-viewer
    do
      /usr/bin/pkill -STOP $process
    done

    Fīle: /usr/local/share/dbus-scripts/screen-unlock
    Code:
    #!/bin/ash
    
    for process in browserd scim-panel-gtk image-viewer
    do
      /usr/bin/pkill -CONT $process
    done
    Make all of the above scripts executable!

    Now restart dbus-scripts:
    Code:
    # killall dbus-scripts
    You can do likewise for screen dimming, keyboard closing etc, to your preference. Just be sure to think through the consequences.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Xagoln; 2011-05-13 at 18:45. Reason: added link to Wiki, plus info on installing dbus-scripts
    The Following 21 Users Say Thank You to Xagoln For This Useful Post:
    aBs0lut3z33r0, cheve, drangina, Estel, F2thaK, fasza2, hawaii, Hurrian, Joseph9560, Mentalist Traceur, optimaxxx, pfontana77, S0urcerr0r, shawwawa, Sohil876, stlpaul, totalentropy, Transcend, Trestry, zvogt

     
    Xagoln | # 2 | 2011-05-13, 17:45 | Report

    I will leave my phone locked overnight to see how it fares.

    Could be worth holding off on doing this until I confirm long periods of locking don't cause any issues.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Xagoln For This Useful Post:
    shawwawa

     
    hawaii | # 3 | 2011-05-13, 18:25 | Report

    FWIW, I use dbuscron as it seems to be more stable for me. With some intelligent scripting and fcron, it would be possible to grab the PID that's chewing unnecessary cycles and pause it when locked.

    A lot of user spawned processes can be paused that aren't necessary; calendar, hildon-input-method, camera-ui are a few I've been doing with no issue.

    Curiously, I wonder what happens if you try and issue STOP to hildon-desktop, hildon-home and hildon-status-menu...

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by hawaii; 2011-05-13 at 18:49.
    The Following 3 Users Say Thank You to hawaii For This Useful Post:
    Estel, Mentalist Traceur, Trestry

     
    hawaii | # 4 | 2011-05-13, 19:17 | Report

    Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

    I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

    I want thumbnailer and tracker to run, so renice to +19 and call it a day.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to hawaii For This Useful Post:
    Estel, Mentalist Traceur, Trestry

     
    vi_ | # 5 | 2011-05-13, 21:20 | Report

    Originally Posted by hawaii View Post
    Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

    I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

    I want thumbnailer and tracker to run, so renice to +19 and call it a day.
    You have my attention, please tell me more about this hawaii...

    FYI I have 2 scripts.

    1. Under-clocks and under-volts the phone to THE MAX. This is tied into the n900 'device inactive' dbus signal. I am unsure what the trigger is but it seems to appear a short while after the screen goes off. This only happens if the keyboard is closed AND the back light is off. This means if the n900 is doing something that will take a while and i don't want it to under power I just leave the keyboard open.


    2. A clock and voltage back up script, this is triggered when the device is unlocked.


    This means that i have been able to get rid of the kernel-power-settings script (I have a local copy loading settings). For some reason it occasionally causes my n900 to spazz out with ~8000 wake ups per second keeping it in C0.

    For a while I was experimenting with stopping bme when the device was asleep however it wasnt easy to detect the 'plugged in, bme not started' condition (there is no dbus signal when BME is stopped), further more BME would just stop working after a bunch of start/stops :/ Although stopping BME was saving me around 200~wakeups/30s...

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to vi_ For This Useful Post:
    Estel, Mentalist Traceur

     
    vi_ | # 6 | 2011-05-13, 21:22 | Report

    Originally Posted by hawaii View Post
    Don't bother pausing hildon-desktop or home on lock trigger. Too many processes hook into them, namely phone calls don't work :P

    I've shut off osso-xterm, calendar, camera-ui, browserd, image-viewer, hildon-input-method.

    I want thumbnailer and tracker to run, so renice to +19 and call it a day.
    Also who do I have to renice to get a bl0w...the process that deals with teh phone, what is his nice and can I crank it to the max?

    Also what is hawaii's opinion on the mlocker application?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Megaltariak | # 7 | 2011-05-13, 21:31 | Report

    Simpler, if you don't want default services to be running you can look in /usr/share/applications/hildon/ and open .desktop files (the modest one for example), then comment out with a # these kind of lines:
    X-Maemo-Prestarted=always
    X-Maemo-Prestarted-Priority=2000

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to Megaltariak For This Useful Post:
    cheve, Estel, mehulrajput

     
    hawaii | # 8 | 2011-05-13, 21:52 | Report

    Originally Posted by vi_ View Post
    Also who do I have to renice to get a bl0w...the process that deals with teh phone, what is his nice and can I crank it to the max?

    Also what is hawaii's opinion on the mlocker application?
    omhd already takes care of setting priority for daemons and applications that handle incoming calls.

    I use mlocker for the X server and I automatically set hildon-home, hildon-desktop and a few other core processes to FIFO or RR real time status when using the BFS scheduler.

    I have no idea why you'd want to stop BME?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to hawaii For This Useful Post:
    Estel, Mentalist Traceur, vi_

     
    dimbert | # 9 | 2011-05-13, 22:04 | Report

    Any chance of making a script/app that you can choose witch process to stop and setup the trigger behavior!!!

    I love my N900 and read all the TMO just for increase my batt life!

    Good work you all!

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to dimbert For This Useful Post:
    Transcend

     
    Xagoln | # 10 | 2011-05-14, 00:42 | Report

    Originally Posted by Megaltariak View Post
    Simpler, if you don't want default services to be running you can look in /usr/share/applications/hildon/ and open .desktop files (the modest one for example), then comment out with a # these kind of lines:
    X-Maemo-Prestarted=always
    X-Maemo-Prestarted-Priority=2000
    Thanks for the tip.

    Some of these services, like scim-panel-gtk, are very useful to have when using the phone interactively. And totally redundant when the device is locked.

    Also, I'd be weary of dsme/watchdog. Out of ignorance, a few weeks ago I renamed the actual browserd executable, frustrated that it would always run and seemed to often keep my CPU busy even when I'd closed all my browser windows. The dsme rebooted the phone within 5 seconds, and I ended up with a reboot loop.

    Would adjusting those values satisfy dsme and stop it rebooting?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 1 of 3 | 1   2     3   | Next
vBulletin® Version 3.8.8
Normal Logout