Saturday, April 27, 2013

Garbage collection messages

The structure of the garbage collection is the following:


04-27 10:39:28.982   387   397 D dalvikvm: GC_EXPLICIT freed 89K, 17% free 15805K/19020K, paused 2ms+5ms, total 63ms


04-27 10:39:25.959  3060  3064 D dalvikvm: GC_CONCURRENT freed 384K, 6% free 8818K/9300K, paused 2ms+2ms, total 22ms



Reason:
  • GC_CONCURRENT
  • GC_FOR_MALLOC - full heap, stop app to collect to increase the loc 
  • GC_EXTERNAL_ALLOC
  • GC_HPROF_DUMP_HEAP - for profiling
  • GC_EXPLICIT - when called System.gc()
Memory statistics about the garbage collection:
  • number of bytes freed
  • amount of free memory after garbage collection
  • number of objects that are alive / total heap size
Pause times:
  • pauses at start/end of the garbage collection process

Monday, April 15, 2013

MultiCore toolkits


  • http://software.intel.com/sites/products/documentation/doclib/tbb_sa/help/index.htm#tbb_userguide/title.htm

Sunday, March 31, 2013

Profiling Power Consumption on Android

Profiling Power Consumption on Android

Over the past couple of days, I have been trying to figure out a painless method for collecting energy performance on Android mobile phones. I was really happy to discover that my Galaxy Nexus phone reports power events using ftrace. Moreover, cpu_idle reports the time time spent in each low-power state using sysfs. To capture the time spent in each state, it is just a matter of reading a few files. Pretty sweet.

Since both methods seemed so easy to implement, I ended up implementing it both ways: compute the time spent in each c-state using ftrace (sum up the reported c-state residency) and via the results reported in sysfs. To my surprise, the two results did not match --- if fact they were nowhere close to similar.

While the jury is not yet out, it seems like the difference between the reported statistics are due to the state coupling that is necessary so that the two cores of OMAP to enter the low power state. The following mails seem to validate this hypothesis:

  • http://comments.gmane.org/gmane.linux.ports.arm.omap/77416


Below are some notes on tools:

Systrace:



# tracer: function
#
#           TASK-PID   CPU#    TIMESTAMP  FUNCTION
#              | |      |          |         |
            bash-4251  [01] 10152.583854: path_put <-path_walk class="l" span="">
bash-4251 [01] 10152.583855: dput <-path_put class="l" span=""> bash-4251 [01] 10152.583855: _atomic_dec_and_lock <-dput pre="">
The time is in the format .

CPUFreqUtils:

Very nice description of linux support for power consumption:
http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.power.html#sec.tuning.power.tools.cpufrequtils

The cpuidle subsystem controls when a system goes to sleep. A description of the system can be found here. The nice part of cpuidle is that it exports a ton of important events on sys-fs. A complete description can be found here.

http://lwn.net/Articles/473072/
http://comments.gmane.org/gmane.linux.ports.arm.omap/77416
http://scape.cs.vt.edu/wp-content/uploads/2012/08/ITJ12_Android_Energy-Aware.pdf

References:

  1. Galaxy Nexus Hardware
  2. Cortex-A9 Power Management