Computer Laboratory Energy Performance and Accounting in Mobile Operating Systems James Snee and Andrew Rice 1
Too many features not enough energy... 2
Where is the energy spent?? 3
Power (Watts) What is the phone doing? Seconds (s) 4
Even the idle state of the device is unpredictable Patterns exist Power (Watts) High variance in power consumption Seconds (s) 5
Frequency Density Changes in the OS can have profound effects Joules Andrew Rice, Simon Hay, Measuring mobile phone energy consumption for 802.11 wireless networking, Pervasive and Mobile Computing, Volume 6, Issue 6, December 2010, Pages 593-606 6
Power (Watts) Android 1.1 checks that no one is using the same IP address Time (seconds) Andrew Rice, Simon Hay, Measuring mobile phone energy consumption for 802.11 wireless networking, Pervasive and Mobile Computing, Volume 6, Issue 6, December 2010, Pages 593-606 7
Power (Watts) Android 2.1 doesn t bother checking... Time (seconds) Andrew Rice, Simon Hay, Measuring mobile phone energy consumption for 802.11 wireless networking, Pervasive and Mobile Computing, Volume 6, Issue 6, December 2010, Pages 593-606 8
Consumption difference found by monitoring the network Some effects not visible outside the device 9
What s going on inside the device? We instrument Android s Linux Kernel Applications Middleware / Services Native interfaces Linux Kernel 10
We are able to make use of existing profiling tools KProbes DTrace Perf SystemTap FTrace Valgrind OProfile Linux Trace Toolkit 11
We are able to make use of existing profiling tools KProbes DTrace Perf SystemTap FTrace Valgrind OProfile Linux Trace Toolkit 12
Power (Watts) We logged every system call made during idle test using FTrace Seconds (s) 13
FTrace places instrumentation in every system function Adds a call to the mcount routine in the prelude of every function (mcount: arch/arm/kernel/entry-common.s) This routine stores tracing information into a small ring-buffer Requires a rooted device and a custom built kernel 14
Example FTrace (function tracer) trace output [Process Name] [CPU] [Time since boot]: [function] <- [parent] 131.677753: fsnotify_parent <-vfs_write 131.677764: fsnotify <-vfs_write 131.677765: srcu_read_lock <-fsnotify 131.677767: srcu_read_unlock <-fsnotify 131.677772: sys_dup2 <-ret_fast_syscall 131.677773: sys_dup3 <-sys_dup2 131.677774: expand_files <-sys_dup3 131.677775: filp_close <-sys_dup3 131.677776: locks_remove_posix <-filp_close 131.677778: fput <-filp_close 131.677779: fsnotify_parent <-fput 131.677780: fsnotify <-fput 131.677781: locks_remove_flock <-fput 131.677783: module_put <-fput 131.677784: put_pid <-fput 131.677785: file_sb_list_del <-fput 131.677787: files_lglock_local_unlock_cpu <-file_sb_list_del 131.677789: drop_file_write_access <-fput 131.677790: mnt_drop_write <-drop_file_write_access 131.677791: call_rcu <-fput 15
Annotated the first 1ms of the idle trace Power (Watts) 1ms Seconds (s) 16
Too much noise in the data Power sampled at 10kHz 17
Instrument individual functions with SystemTap Applications Middleware / Services Native interfaces ST ST Linux Kernel ST ST FTrace 18
SystemTap instruments the Kernel without the need to recompile Tap Script Translate to C Insert and run Build Kernel Module Report back the internal state of functions Safer interface to kprobes, no more panics 19
consumed per kilobyte (J) Energy Energy consumed per kilobyte (J) WiFi + TCP energy consumption appears to follow a trend 0.1 0.09 0.08 0.07 0.06 0.05 0.04 0.03 0.02 0.01 0 10 20 30 40 50 60 Message size (kb) Message Size (kb) Andrew Rice, Simon Hay, Measuring mobile phone energy consumption for 802.11 wireless networking, Pervasive and Mobile Computing, Volume 6, Issue 6, December 2010, Pages 593-606 20
Energy consumed per kilobyte (J) We re using SystemTap to investigate these outliers Message Size (kb) What s going on inside TCP? Andrew Rice, Simon Hay, Measuring mobile phone energy consumption for 802.11 wireless networking, Pervasive and Mobile Computing, Volume 6, Issue 6, December 2010, Pages 593-606 21
We are using SystemTap to instrument the Linux TCP implementation probe kernel.function("*@net/ipv4/tcp.c").call{ printf("tcp %ul %s>%s \n",gettimeofday_s(),thread_indent(1),probefunc()) } 22
Moving instrumentation into the OS is giving us a better picture of what s going on http://www.ubiquitense.com/wp-content/improve-android-battery-life.gif 23
Computer Laboratory Energy Performance and Accounting in Mobile Operating Systems James Snee and Andrew Rice Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. 24