Presentation is loading. Please wait.

Presentation is loading. Please wait.

Energy Metering and Tracking with iCount and Quanto IPSN 2009 Tutorial – San Francisco – April 16 th, 2009 Prabal Dutta Rodrigo Fonseca Thoma Schmid.

Similar presentations


Presentation on theme: "Energy Metering and Tracking with iCount and Quanto IPSN 2009 Tutorial – San Francisco – April 16 th, 2009 Prabal Dutta Rodrigo Fonseca Thoma Schmid."— Presentation transcript:

1 Energy Metering and Tracking with iCount and Quanto IPSN 2009 Tutorial – San Francisco – April 16 th, 2009 Prabal Dutta Rodrigo Fonseca Thoma Schmid

2 quanto /’kwän  to/ Portuguese (from Latin quantu) interrogative pronoun - how much, what amount, what quantity, what number, what price

3 Introductions tell us about yourselves prabal@eecs.berkeley.edu rodrigo.fonseca@gmail.com thomas.schmid@ucla.edu

4 Schedule 1:00 – 2:30 Presentation 2:30 – 3:00 Break 3:00 – 5:00 Hands on Goals: –Present the concepts behind Quanto –Get you excited by instrumenting, running, and analyzing simple applications

5 Outline Demo: Blink Introduction How much energy? iCount –Principles –Calibration What is using my energy? –Energy breakdown Why is it using my energy? –Activity Tracking Quanto in Practice –Architecture –Interesting Findings –Recording Information Hands on Session

6 Blink Demo

7 7 Blink: What’s happening? 48 seconds of Blink Dedicated Resources Logical Threads of Execution Shared Resources

8 8 Where have all the Joules gone? “Slice” by device “Track” by activity 48 seconds of Blink

9 9 Blink: Instrumentation module BlinkC () { uses interface Timer as Timer0; uses interface Timer as Timer1; uses interface Timer 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() { call Leds.led0Toggle(); } event void Timer1.fired() { call Leds.led1Toggle(); } event void Timer2.fired() { call Leds.led2Toggle(); } module BlinkC () { uses interface Timer as Timer0; uses interface Timer as Timer1; uses interface Timer 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() { call Leds.led0Toggle(); } event void Timer1.fired() { call Leds.led1Toggle(); } event void Timer2.fired() { call Leds.led2Toggle(); } }

10 10 Real applications: Many services making concurrent use of same hardware Hardware Power SupplySensorsMCURadioStorage “Trio Network” [Dutta06]

11 11 Three 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 iCount iCount + P-states + Regression Labels

12 Outline Demo: Blink Introduction How much energy? iCount –Principles –Calibration What is using my energy? –Energy breakdown Why is it using my energy? –Activity Tracking Quanto in Practice –Architecture –Interesting Findings –Toolchain Hands on Session

13 13 Three 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 iCount Labels iCount + P-states + Regression

14 14 Measuring: wide horizontal/vertical dynamic range TX packet at 1% duty cycle (20 ms / 2 s) 4,000 ms 640,000 ms 86,400,000 ms [Farkas00] 30 ms

15 15 Dynamic range in power draw exceeds 10,000:1 < 1 µW > 50 mW

16 16 Current energy metering techniques are inadequate cumbersome, expensive, not distributed, not scalable, not embedded, low resolution cumbersome, expensive, not distributed, not scalable, not embedded, low resolution, low responsiveness, high quiescent power low responsiveness, high cost, high quiescent power DS2438 ADM1191 BQ2019 BQ27500 [Jiang07]

17 17 Key insight: Switching regulators inherently meter energy If your platform has a PFM switching regulator… (many do) add a wire iCount energy meter design

18 18 How does it work? Source: Maxim Semiconductor C in LxLx V in C out V out R load i LX Energize Transfer Monitor S1S1 S2S2 V LX E=½Li 2 PFM Regulator

19 19 Each cycle transfers a fixed energy quanta to the load ΔE=½Li 2 P=ΔE/ΔtP=ΔE/Δt Counting cycles translates to measuring energy Regulator Cycles

20 20 This simple design works surprisingly well MAX1724 Prototype implementation [HydroWatch] (UCB) [Benchmark] (UCB) [Quanto] (UCB) [Quanto+] (UCLA) [Senseweb] (WSU)

21 21 Hardware costs: wire and counter “wire” Counter HydroSolar Node (v2)

22 22 iCount Performance summary Performance MetriciCount Range1 µA – 100 mA Accuracy±10% (±20%, full range) Resolution0.1 µJ – 0.5 µJ Read latency24 µs Power overhead0.01% - 1% Responsiveness< 125 µs Precision±1.5% (over 2 secs, N=167) Stability±1% (over 1 week)* * Frequency averaged over 1 second

23 Outline Demo: Blink Introduction How much energy? iCount –Principles –Calibration What is using my energy? –Energy breakdown Why is it using my energy? –Activity Tracking Quanto in Practice –Architecture –Interesting Findings –Toolchain Hands on Session

24 24 Three 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 iCount Labels iCount + P-states + Regression

25 25 Slicing: 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 “Itsy”

26 26 Not all energy sinks can be instrumented MCU Radio Power FlashSensorsLEDs PowerData Control USART DMA OSC Timer ADC RXTX LNAPA CPU

27 27 A different approach to energy slicing: power state tracking* On Off * H. Zeng et al. “ECOSystem: Managing Energy as a First Class Operating Systems Resource”, ASPLOS’02, 2002. Export device power states Through a narrow interface OS tracks/logs state transitions

28 28 Estimate energy breakdowns with regression For every power state transition –Snapshot system-wide power states (α 1,…, α n ) –Snapshot global energy usage (ΔE) –Snapshot system clock (Δt) Generate an equation of the form ΔE/Δt = α 1 p 1 +… +, α n p n (p’s are the unknown power draws) Solve for p’s using weighted multivariate least squares High-resolution, high-speed energy meter key for good results ΔtΔt ΔEΔE α’s pipi

29 29 Example power state equations ΔE/Δt= α 1 p 1 + α 2 p 2 + α 3 p 3 + α 4 p 4 + α 5 p 5 2/1= 1·p 1 + 1·p 2 + 1·p 3 + 1·p 4 + 0·p 5 3/1.1= 1·p 1 + 1·p 2 + 1·p 3 + 1·p 4 + 1·p 5 1/0.4= 1·p 1 + 0·p 2 + 1·p 3 + 1·p 4 + 1·p 5 0/0.4= 1·p 1 + 0·p 2 + 0·p 3 + 1·p 4 + 1·p 5 1/0.6= 1·p 1 + 0·p 2 + 0·p 3 + 0·p 4 + 1·p 5 0/0.6= 1·p 1 + 0·p 2 + 0·p 3 + 0·p 4 + 0·p 5 ΔEΔE α’s pipi Y = ΔE/Δt AP = Y P = A -1 Y W = diag( √(Δt*ΔE) ) P = (A T WA) -1 A T WY

30 Outline Demo: Blink Introduction How much energy? iCount –Principles –Calibration What is using my energy? –Energy breakdown Why is it using my energy? –Activity Tracking Quanto in Practice –Architecture –Interesting Findings –Toolchain Hands on Session

31 31 Three 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 iCount Labels iCount + P-states + Regression

32 32 Tracking: gap between what is measured and what matters Itsy measured –Breakdown by subsystem –For each 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.”, SOSP’99, Kiawah Island, SC, 1999

33 33 What’s wrong with subsystems, PCs, and PIDs? Subsystem –No distinction between different logical activities –Is radio sending a routing beacon or data packet? Program Counter –Pinpoints code hotspots –But, not the data on which the code operates –Routing beacon? Time sync packet? Data packet? Process ID –Most sensornet applications are I/O bound –Most energy is spent outside the CPU –For I/O-bound processes, PID-based sampling is biased

34 34 Activities* are what actually matters * M.B. Jones et al., “Modular Real-Time Resource Management in the Rialto Operating System”, HotOS’95, 1995. G. Banga et al. “Resource Containers: A New Facility for Resource Management in Server Systems”, OSDI’99, 1999. H. Zeng et al. “ECOSystem: Managing Energy as a First Class Operating Systems Resource”, ASPLOS’02, 2002. A causally-connected set of operations… whose distinct resource consumptions… should be grouped together for accounting*

35 35 Three steps to activity tracking Annotating –Any abstraction can introduce an annotation –Associates an activity “label” with an execution –Labels are pairs Propagating –System software transfers activity labels –Across subsystems, nodes, and deferred computations Recording –Track, log, and post-process resource usage

36 36 Annotating 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( ) Quanto automatically propagates labels... CPUActivity.set(ACT_SENSING); Sensor.read();... CPUActivity.set(ACT_STORING); Flash.write(...);... CPU Sensor Flash Node A Act: sensing Act: storing

37 37 Propagating labels over deferred 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

38 38 Propagating labels over the network CPU Flash Radio Node B CPU Sensor Radio Node A Act: sensingAct: sending Proxy Rx activityPacket Tx Add hidden field to packet Sender’s OS sets activity field Radio.send(message_t* msg) {... msg->header->activity = CPUActivity.get();... }

39 39 Propagating unknown labels using proxy activities CPU Flash Radio Node B CPU Sensor Radio Node A Act: sensingAct: sending Proxy Rx activityPacket Tx 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 message_t* Radio.recv(message_t* msg, void* payload, uint8_t len) {... CPUActivity.bind(msg->hdr->activity);... }

40 40 Concurrent activities on shared resources async command void Timer.start() { call TimerActivity.add(call CPUActivity.get());... } async event void HardwareTimer.fired() { signal Timer.fired(); call TimerActivity.remove(call CPUActivity.get());... } Activity A Activity B Timer Power State Timer.firedTimer.start Timer.firedTimer.start AA/BB Timer Activities Add A Add B Rem A Rem B Time

41 41 Three 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 iCount iCount + P-states + Regression Labels

42 Outline Demo: Blink Introduction How much energy? iCount –Principles –Calibration What is using my energy? –Energy breakdown Why is it using my energy? –Activity Tracking Quanto in Practice –Architecture –Interesting Findings –Recording Information Hands on Session

43 43 Summary of Quanto energy profiling architecture Device Drivers Hardware Application Operating System,,,,, propagate labels over deferred computations monitor/expose power statessave/restore/expose activity meter energy usage annotate code with activity labels propagate labels to/from devices log and process activity/power data

44 44 Interesting Findings: catching power bugs. Why is TIMERA firing at 16Hz?!?

45 45 How much time and energy does using DMA really save? Using DMA can subvert MAC layer fairness

46 46 What’s the cost of false alarms in Low-Power Listening? PreambleD TX RX D T listen Noise Overhearing adds significant unpredictability to node lifetime

47 47 Recording: log, export, and post-process data Challenge is getting data off the node Reason most applications are still toys Burst: 10KB RAM Log + UART Out Burst 128K FIFO Log + UART Out Continuous: Compression + UART Out Continuous: Parallel Out + Ethernet

48 Logging Solutions Log to RAM: –12 bytes per logged event –Buffer for 700 events –Dump to UART once buffer is full Log to parallel port –Fast, real-time logging –Not scalable to multiple nodes Log to the UART, compressed –Blink running at 50ms, no compression: logging takes 80.9% of CPU time –With compression: 25% of CPU time, compression of 3.84X (each log entry ~ 3.1 bytes) –Not enough for larger applications RadioCountToLeds, 2 nodes @100ms: –427 ev/s –With LPL: 1617 ev/s

49 Logging Solutions Don’t trace: count Step 1: online accounting of activities –Time per activity per resource –Almost ready Step 2: online regression –Accumulating power state info –Doing regression online Current Status –The next release of Quanto will have online accounting of the activity times

50 Hands-on Section Instrument, record data, process, visualize –Basic: Blink –Cross-network: RadioCountToLeds If we have time: –LPL: Bounce –Another example: FTSP

51 Questions

52 References Quanto Website: –http://quanto.cs.berkeley.edu Quanto code: –tinyos-2.x-contrib/berkeley/quanto Network Management Interface: Papers: –“Energy Metering for Free: Augmenting Switching Regulators for Real-Time Monitoring” Prabal Dutta, Mark Feldmeier, Joseph Paradiso, David Culler. IPSN’08 –“Quanto: Tracking Energy in Networked Embedded Systems”, Rodrigo Fonseca, Prabal Dutta, Philip Levis, and Ion Stoica. OSDI’08


Download ppt "Energy Metering and Tracking with iCount and Quanto IPSN 2009 Tutorial – San Francisco – April 16 th, 2009 Prabal Dutta Rodrigo Fonseca Thoma Schmid."

Similar presentations


Ads by Google