following reasons: (1) It is a developer phone that al-
lows, due to an open boot loader, to install modified
Android versions without the need for jailbreaking.
(2) It makes use of a single-core Qualcomm proces-
sor; problems that may arise when measuring energy
requirements during parallel execution are avoided.
(3) It can easily be disassembled in order to get ac-
cess to relevant hardware components. (4) It can be
altered in order to attach measurement lines.
We attached sense resistors to the (direct) voltage
supplies of core, power supplies, etc. A digital oscil-
loscope continuously measures the voltage drops at
theses resistors. Data is sent to and stored/processed
by a a small industrial personal computer that pre-
processes the raw data and calculates energy values
(in Joule) for a predefined time period.
Typically, Android systems run several processes,
services, or threads in parallel. It is not unusual that
after some hours of operations more than 70 threads
or processes are active and thus, are increasing the
system load. Unfortunately, to satisfy all requests, the
system randomly switches between processes (based
on process priorities). In order to exactly measure the
energy demand that is related to a specific software ar-
tifact, switching might introduce measurement errors.
During our studies we had to learn that, although we
are able to identify process switching via triggering,
we cannot guarantee for loss-free measurements. So,
we stripped our custom Android ROM and switched
off as many services and processes as possible.
Most Android apps are written in Java. The
Dalvik VM executes the Java byte code by the line.
Every app is associated to its own VM instance in a
separate GUI thread and may spawn separate threads
and processes if needed. The garbage collector that
manages the memory is an additional error source re-
garding energy measures. Furthermore, the use of
kernel functions (i.e., triggering) is only possible us-
ing JNI that increases complexity and implies limita-
tions of the stripped Android version. So, we used the
Android NDK, aimed for performance critical apps. It
allowed us to execute software directly on the Linux
kernel without using the VM.
4 SOFTWARE-BASED MEASURE
Software-based measurement of power consumption
and energy demands is an interesting alternative to the
previously discussed hardware-based approach. The
advantage being that no additional hardware compo-
nents are required. This allows measurements in the
field and with a short preparation phase. Power and
energy characteristics are measured through the de-
vice’s internal power management software compo-
nents. Technically, these components are used to cal-
culate the remaining uptime of the device.
Most smartphone SDKs provide high-level access
to interpreted power management values in the form
of percentage of full charge, or remaining battery ca-
pacity in mAh. While this information is sufficient to
react to emergency situations (nearly empty battery),
it is not sufficient to make clear statements about the
energy demands of software or software components.
Regarding the source of the power and energy data
that is gathered with a software-based measurement,
two approaches can be distinguished:
In the model-based approach, a cost model re-
garding the power consumption and energy demands
for the hardware of a mobile device is required. For
each component, different operation states have to be
respected (e. g., the Wi-Fi chipset may be in a low-
power sleeping state, or at its highest power setting
while transmitting at high speeds on a weak chan-
nel). Hence, a high level of granularity and accuracy
is required for every feature in the model. The Pow-
erTutor project (PowerTutor, 2011), e. g., used high-
accuracy hardware-based measurements to determine
a device’s power and energy properties. Given the
model, statements regarding the power consumption
of a given software can be made by measuring the in-
tensity of use of the involved hardware components
(e. g., How long was the display turned on?) and their
state (e. g., Which brightness setting was it on?). Inte-
grating the cumulated power consumption of all com-
ponents provides a measure for their energy demand.
Compared to hardware-based measures, this ap-
proach clearly cannot provide the same level of ac-
curacy as it bases on constant values for the power
consumption of individual components. The Power-
Tutor system can reach 99.2 % of accuracy for short
measurement periods (10 s intervals), compared to an
actual hardware measurement (Zhang et al., 2010).
The applicability of the model-based approach is
also limited to the devices included in the model. For
unknown devices, no assumptions can be made as
used hardware components and their characteristics
vary greatly between different devices.
The data-based approach relies on live data.
Some smartphones include an electrical current sen-
sor, which provides in combination with up-to-date
voltage data from the device’s battery all required data
to calculate electrical power (cf. Figure 1).
There are, however, two major drawbacks to this
approach: resolution and availability. In our experi-
ence, the data provided by the smartphones is updated
only at a very low frequency. Values tend to remain
stable for a few seconds, even when there is actually a
OnMeasuringSmartphones'SoftwareEnergyRequirements
167