Title: Tracking Energy in Networked Embedded Systems
1Tracking Energy in Networked Embedded Systems
Rodrigo Fonseca, Prabal Dutta, Philip Levis,
Ion Stoica
Computer Science Division University of
California, Berkeley prabal,istoica_at_cs.berkeley.
edu
Computer Science Department Stanford
University pal_at_cs.stanford.edu
Yahoo! Research Santa Clara, CA rfonseca_at_yahoo-in
c.com
OSDI08 San Diego, California Dec. 8-10, 2008
2Motivationin mote-class sensor networks,
energy is the defining constraint
- Wide dynamic range
- 10 mA active current
- 10 uA sleep current
- 0.1 1 duty cycle
- Limited energy reserve 2 AA batteries typical
- CPU 10 MIPS
- RAM 4 KB to 10 KB
- ROM 32 KB to 128 KB
- Flash 512 KB to 1 MB
- Radio 40 kbps to 250 kbps
2000 mA-Hr
3Energy-efficient design pervades the research
agenda
Energy-efficiency is measured by packets sent,
time sleeping, bytes written
these are all (incompatible) proxy measures.
4Three basic challenges
- Energy metering
- Measure energy usage
- i(t) ? p(t) ? ?p(t)dt
- Energy breakdown
- Slice usage horizontally
- Allocate usage to energy sinks
- Activity tracking
- Dice usage vertically
- Track causal connections
5Whats an activity? Connecting the causal dots
- A causally-connected set of operations
- whose distinct resource consumptions
- should be grouped together for accounting
M.B. Jones et al., Modular Real-Time Resource
Management in the Rialto Operating System,
HotOS95, 1995. G. Banga et al. Resource
Containers A New Facility for Resource
Management in Server Systems, OSDI99, 1999.
6A toy example where have all the Joules gone?
Slice by device
48 seconds of Blink
Track by activity
7Outline
- Introduction
- Why is it hard and how do you solve it?
- Energy Metering (measuring)
- Energy Breakdown (slicing)
- Activity Tracking (dicing and tracking)
- How well does it work?
- How much does it cost?
- How could it be used?
- What are its limitations?
8Measuring wide horizontal/vertical dynamic range
86,400,000 ms
640,000 ms
Farkas00
TX packet at 1 duty cycle (20 ms / 2 s)
4,000 ms
30 ms
9Dynamic range in power draw exceeds 10,0001
gt 50 mW
lt 1 µW
10Quanto uses iCount to solve energy metering
challenge
Prabal Dutta, Mark Feldmeier, Joseph Paradiso,
and David Culler, Energy Metering for Free
Augmenting Switching Regulators for Real-Time
Monitoring, IPSN08, St. Louis, MO, 2008. Best
Paper Award and ISLPED08 Design Contest Winner.
11Outline
- Introduction
- Why is it hard and how do you solve it?
- Energy Metering (measuring)
- Energy Breakdown (slicing)
- Activity Tracking ( tracking)
- How well does it work?
- How much does it cost?
- What are its limitations?
- How can it be used?
12Slicing breaking down the envelope into its parts
Marc A. Viredaz and Deborah A. Wallach, Power
Evaluation of a Handheld Computer, IEEE Micro,
Jan-Feb, 2003
13Not all energy sinks can be instrumented
Power
MCU
USART
CPU
OSC
ADC
DMA
Timer
LNA
PA
Radio
Flash
Sensors
LEDs
RX
TX
Power
Data
Control
14A different approach to energy slicing power
state tracking
On
Off
- Instrument device drivers
- Export device power states
- Through narrow interface
- OS tracks state transitions
H. Zeng et al. ECOSystem Managing Energy as a
First Class Operating Systems Resource,
ASPLOS02, 2002.
15Estimate energy breakdowns with regression
?E
- For every state transition
- Snapshot system-wide power states (a1,, an)
- Snapshot global energy usage (?E)
- Snapshot system clock (?t)
- Generate an equation of the form
- ?E/?t a1p1 , anpn
- (ps are the unknown power draws)
- Solve for ps using weighted multivariate least
squares
as
pi
?t
High-resolution, high-speed energy meter key for
good results
16Outline
- Introduction
- Why is it hard and how do you solve it?
- Energy Metering (measuring)
- Energy Breakdown (slicing)
- Activity Tracking (tracking)
- Abstractions
- Mechanisms
- Challenges
- How well does it work?
- How much does it cost?
- What are its limitations?
- How can it be used?
17Tracking gap between what is measured and what
matters
- Itsy
- Measured
- Breakdown by subsystem
- Breakdown by application
- PowerScope
- Measured
- Breakdown by PC
- Breakdown by PID
Marc A. Viredaz and Deborah A. Wallach, Power
Evaluation of a Handheld Computer, IEEE Micro,
Jan-Feb, 2003
Jason Flinn and M. Satyanarayanan, Energy-Aware
Adaptation for Mobile Apps., SOSP99, Kiawah
Island, SC, 1999
18What actually matters? Activities
- Energy metering and slicing show
- How much energy is used
- When energy is used
- Where energy is used
- But why is the energy being spent?
- Activity tracking answers the why question
- Attributes usage to meaningful resource
principals - Not to threads, processes, tasks, functions, or
PC
M.B. Jones et al., Modular Real-Time Resource
Management in the Rialto Operating System,
HotOS95, 1995. G. Banga et al. Resource
Containers A New Facility for Resource
Management in Server Systems, OSDI99, 1999.
H. Zeng et al. ECOSystem Managing Energy as a
First Class Operating Systems Resource,
ASPLOS02, 2002.
19Three steps to activity tracking
- Annotating
- Any abstraction can introduce an annotation
- Associates an activity label with an execution
- Labels are lt origin-node activity-identifier gt
pairs - Propagating
- System software transfers activity labels
- Across subsystems, nodes, and deferred
computations - Recording
- Track, log, and post-process resource usage
20Annotating an activity paints
causally-connected actions
- Sensing involves
- Sensor...
- CPU, ADC, I2C bus,
- Storing involves
- Flash
- CPU, SPI bus, timers,
- Initiate annotation with
- CPUActivity.set(ltlabelgt)
- Quanto automatically propagates labels
Node A
CPU
Sensor
Flash
... CPUActivity.set(ACT_SENSING) Sensor.read() .
.. CPUActivity.set(ACT_STORING) Flash.write(...)
...
21Outline
- Introduction
- Why is it hard and how do you solve it?
- Energy Metering (measuring)
- Energy Breakdown (slicing)
- Activity Tracking (tracking)
- Abstractions
- Mechanisms
- Challenges
- How well does it work?
- How much does it cost?
- What are its limitations?
- How can it be used?
22Deferred computations
- Examples
- CPU ? Post task (deferred function call) ? CPU
- CPU ? Queue object ? CPU
- Task Scheduler
- Add activity field to task structure
- Set activity field on task posting
- Restore activity on task invocation
- Queue
- Tag each entry with its activity label
- Write activity label on enqueue
- Restore activity label on dequeue
23Node-to-Node communications
- Add hidden field to packet
- Senders OS sets activity field
CPU
Node B
Flash
Radio
CPU
Sensor
Node A
Radio
Radio.send(message_t msg) . . .
msg-gtheader-gtactivity CPUActivity.get() . .
.
24Proxy activities
- Every interrupt causes energy consumption
- before activity label is identified
- Interrupt ? CPU
- Timer ? CPU
- Radio ? CPU
- Proxy activity provides ephemeral label
- Binding with real activity occurs when label is
clear
CPU
Node B
Flash
Radio
CPU
Sensor
Node A
Radio
message_t Radio.recv(message_t msg, void
payload, uint8_t len) . . .
CPUActivity.bind(msg-gthdr-gtactivity) . . .
25Concurrent activities on shared devices (see
paper)
Timer.fired
Timer.start
Activity A
Timer.fired
Timer.start
Activity B
Timer Power State
A
A/B
B
Timer Activities
Time
Add A
Add B
Rem B
Rem A
26Outline
- Introduction
- Why is it hard and how do you solve it?
- How well does it work?
- How much does it cost?
- How can it be used?
- What are its limitations?
27Energy breakdown ground truth regression
results agree
48 seconds of Blink
LED0 LED1 LED2 CPU Baseline
Oscope 2.50 mA 2.23 mA 0.83 mA - n/a - 0.79 mA
Quanto 2.51 mA 2.24 mA 0.83 mA 1.43 mA 0.83 mA
28Outline
- Introduction
- Why is it hard and how do you solve it?
- How well does it work?
- How much does it cost?
- How can it be used?
- What are its limitations?
29Software Footprint in TinyOS
30Space, Time and Energy Costs
- Space
- 12 bytes per energy or activity sample
- Logging RAM buffer 800 samples _at_ 12 bytes each
- Time Energy
- Reading time 19 CPU cycles (19 µs)
- Reading energy 24 CPU cycles (24 µs)
- Logging a sample 102 CPU cycles (102 µs total)
- Logging Blink App
- 0.12 of CPU time (60.71 ms / 48 s)
- 71 of CPU active time!
- 0.08 energy (0.41 mJ)
- Quanto can measure its own usage
31Outline
- Introduction
- Why is it hard and how do you solve it?
- How well does it work?
- How much does it cost?
- How can it be used?
- What are its limitations?
32Where have all the Joules gone?
Slice by device
48 seconds of Blink
Track by activity
33Where have all the (milli)seconds gone?
48 seconds of Blink
Activity tracking
34Whats the cost of false alarms in Low-Power
Listening?
D
RX
Tlisten
Preamble
D
Noise
TX
35Does it really work over the network?
- Bounce plays ping-pong with a pair of packets
- Shows activity on Node 1 that started on Node 4
1
4
Labels are lt origin-node activity-identifier gt
pairs
36Why is TIMERA firing at 16Hz?!?
37Outline
- Introduction
- Why is it hard and how do you solve it?
- How well does it work?
- How much does it cost?
- How can it be used?
- What are its limitations?
38Limitations
- Energy Metering
- Requires hardware support
- Input voltage dependence ? Requires calibration
- Hardware tolerances ? Requires calibration
- Energy Breakdown
- Assumes visibility into device power states
- Assumes constant per-state power draws
- Assumes linearly independent equations
- Requires device driver modifications
- Activity Tracking
- Reentrancy not supported
- Requires modifications to OS abstractions
39Summary
Measure
Slice
CPUActivity.set(ACT_LED0) . . . CPUActivity.set(A
CT_LED1) . . . CPUActivity.set(ACT_LED2)
Dice
Track
40Whats Next?
- Deploy new platforms
- Scale from 2 to 1,000 nodes
- Community rollout
- In Sourceforge tinyos-2.x-contrib/berkeley/quanto
- Hardware www.cs.berkeley.edu/prabal/projects/epi
c - Documentation for developers and kernel hackers
- Research directions
- Explore energy complexity of network protocols
in the literature - Compare approximation techniques (e.g. counters
vs tracing) - Software energy metering
- From energy profiling to energy management
Benchmark
Quanto
41Questions? Comments? Discussion?
42Backup Slides
43Recording log, export, and post-process data
- Challenge is getting data off the node
- Reason most applications are still toys
Continuous Parallel Out Ethernet
Burst 10KB RAM Log UART Out
Burst 128K FIFO Log UART Out
Continuous Compression UART Out
44Summary of Quanto energy profiling architecture
Perform regressions, compute energy breakdowns
CPUActivity.set(ACT_SENSING)
Allocate usage to activities
Application
log activity labels
log power states, and time and energy usage
annotate code with activity labels
ltPowerStateTrackgt, ltSingleActivityTrackgt,
ltMultiActivityTrackgt, ltEnergyMetergt
Operating System
propagate labels to/from devices
propagate labels over deferred computations
scheduler
interrupts
arbiters
timers
queues
ltPowerStategt, ltSingleActivitygt, ltMultiActivitygt
Device Drivers
save/restore/expose activity
monitor/expose power states
Hardware
Energy Meter
45Our solution to this problem
- Energy profile by
- Subsystem
- Activity
- Time
call CPUActivity.set(ACT_SENSING)
Application
ltPowerStateTrackgt, ltSingleActivityTrackgt,
ltMultiActivityTrackgt, ltEnergyMetergt
Operating System
ltPowerStategt, ltSingleActivitygt, ltMultiActivitygt
Device Drivers
Hardware
Energy Meter
46How much time (or energy) does using DMA save?
47Blink A toy example
- module BlinkC ()
- uses interface TimerltTMilligt as Timer0
- uses interface TimerltTMilligt as Timer1
- uses interface TimerltTMilligt as Timer2
- uses interface Leds
- uses interface Boot
-
- Implementation
- event void Boot.booted()
- call Timer0.startPeriodic(250)
- call Timer1.startPeriodic(500)
- call Timer2.startPeriodic(1000)
-
- event void Timer0.fired()
- module BlinkC ()
- uses interface TimerltTMilligt as Timer0
- uses interface TimerltTMilligt as Timer1
- uses interface TimerltTMilligt as Timer2
- uses interface Leds
- uses interface Boot
-
- Implementation
- event void Boot.booted()
- call CPUActivity.set(ACT_LED0)
- call Timer0.startPeriodic(250)
- call CPUActivity.set(ACT_LED1)
- call Timer1.startPeriodic(500)
- call CPUActivity.set(ACT_LED2)
- call Timer2.startPeriodic(1000)
-
- event void Timer0.fired()
48Is hardware energy metering really needed?