Productivity Sync Just another WordPress weblog

February 23, 2013

Memory and Power tuning of my HP Envy-17 laptop running ubutnu 12.04

Filed under: Uncategorized — admin @ 3:56 pm

About the box:  home is on an SSD and so is the root.  There is a spinning drive as well.  It has 16GB of 1600MHz RAM.


  • installed laptop-mode-tools
  • changed my sysctl.conf to set “vm.swappieness=2”
  • set my fstab to use ramdisks for temp directories
    • tmpfs /tmp       tmpfs noatime,mode=1777,size=1350m 0 0
      tmpfs /var/tmp   tmpfs noatime,mode=1777,size=1350m 0 0
      tmpfs /var/spool tmpfs noatime,mode=1777,size=1350m 0 0
      tmpfs /var/log   tmpfs noatime,mode=0755,size=1350m 0 0
  • mounted my root using “noatime,nodiratime,discard,errors=remount-ro”
  • turned off the discrete graphics in my rc.local !  This dropped my burn rate from 45W to 13W!!
    • echo ‘OFF’ > /sys/kernel/debug/vgaswitcheroo/switch
  •  lastly I put the following into my rc.local to avoid some latencies in the file system.  It may be overkill:
  • for dev in sda sdb sdc
      if [ -r $DEV ]; then
        echo $QSZ > $DEV
      if [ -r $DEV ]; then
        echo $QSZ > $DEV

man dpkg example worth remembering

Filed under: Uncategorized — admin @ 7:51 am

copy and paste from the man page for dpkg(1):

To make a local copy of the package selection states:

dpkg --get-selections >myselections

You might transfer this file to another computer, and install it there with:

dpkg --clear-selections
dpkg --set-selections <myselections

Note that this will not actually install or remove anything, but just set the selection state on the requested packages. You will need some other application to actually
download and install the requested packages. For example, run

apt-get dselect-upgrade.

February 3, 2013

Android Power HAL

Filed under: Uncategorized — admin @ 8:42 am

A brief overview:

The power HAL came to AOSP in the Jelly Bean release.  Its reason for being was to end of life the early suspend notification call chains in the kernel that Android power management was dependent on.  It has since then expanded to become the user mode agent for boosting the platform performance when user interactivity is important.  This blog posts documents its current implementation in the AOSP master branch as of Feb 2, 2013.

Important files:

  • Interface spec for power HAL plug in power.$(TARGET_BOARD_PLATFORM).so:
    • hardware/libhardware/include/hardware/power.h
    • The comments are very useful and pretty much explain the powerHAL design in use.
  • Sample implementations of power HAL power.$(TARGET_BOARD_PLATFORM).so file can be found (hint: look at the’s for these as well as the c code):
    • hardware/qcom/power
    • device/asus/grouper/power
    • device/samsung/manta/power
    • device/samsung/tuna/power
    • device/generic/goldfish/power
  • Callers of setInteractive powerHAL entry point:
    • frameworks/base/services/jni/com_android_server_power_PowerManagerService.cpp
  • Callers of powerHint powerHAL entry point:
    • frameworks/base/services/jni/com_android_server_power_PowerManagerService.cpp
    • frameworks/native/services/surfaceflinger/DisplayHardware/PowerHAL.cpp

Pretty simple.  setInteractive is basically called when the screen is turned on and off with different parrameters with the expectation that the powerHAL .so file will poke the kernel interfaces to notify whatever is needed to be notified that the screen is off or on.  powerHint is used for busting the performance on user interactivity or graphics activity going on (UI / UX animations)

There isn’t much more to say other than you should look a the example implementations of powerHAL’s available to get an idea on how people have implemented it for specific hardware and mimic them for yours.  When ready you simply add “power.<your target board platform name>” to the PRODUCT_PACKAGES list in your device’s (or a mk file that AndroidProducts includes) and you have a Power HAL.


Powered by WordPress