软件低功耗设计
低功耗设计的原理

低功耗设计的原理低功耗设计是指通过降低电路或系统的功耗,以实现更长的电池续航时间或更少的能源消耗。
在如今电池寿命短、能源供应有限的背景下,低功耗设计变得越来越重要。
下面将从电源管理、电路设计和软件优化等方面介绍低功耗设计的原理。
一、电源管理1. 选择低功耗组件:在设计电路时,应尽量选择低功耗的组件,例如低功耗微控制器、低功耗传感器等。
这些组件具有较低的静态功耗和动态功耗,能够有效降低整体功耗。
2. 睡眠模式设计:通过在系统中设计睡眠模式,降低待机功耗。
在睡眠模式下,关闭不必要的模块和功能,进入低功耗状态。
在实际使用中,应根据实际需求选择合适的睡眠模式和唤醒机制。
3. 降压和功耗优化:采用降压技术可以使芯片和外围设备在较低的电压下工作,从而降低功耗和能耗。
此外,通过功耗优化算法,合理分配能量需求,减少不必要的能源消耗。
二、电路设计1. 优化时钟频率:时钟是电路中最大的功耗源之一,因此通过降低时钟频率可以有效降低功耗。
在设计过程中,选择适当的时钟频率,避免过高的频率导致功耗过大。
2. 电源管理单元(PSU)设计:通过合理配置电源管理单元,实现对系统的有效电源控制。
包括电源切换、电源管理和电源监测等功能,可以降低系统的功耗。
3. 优化功率放大器:在模拟电路设计中,功率放大器通常是功耗最大的部分之一。
通过优化功率放大器结构和电流控制,降低功耗是一种常用的设计方法。
三、软件优化1. 休眠与唤醒机制:合理利用休眠与唤醒机制,将系统在闲置状态下的功耗降到最低。
通过软件设置合适的休眠模式和唤醒方式,在不影响系统正常工作的前提下降低功耗。
2. 任务调度与优化:通过优化任务调度算法,合理分配任务执行优先级和时间片,减少CPU空闲时间和功耗。
合理利用中断,减少循环检测时间,优化任务执行时间等也可以降低系统的功耗。
3. 数据传输与处理优化:在数据传输和处理过程中,通过减少数据传输次数和数据处理时间,以及合理选择数据压缩和数据加密算法等手段,降低系统的功耗。
低功耗算法

低功耗算法
低功耗算法是指在设计和实现计算机系统、电子设备或传感器等硬件系统时,采用一系列策略和技术来最小化系统的功耗。
这些算法旨在通过降低电流、电压和频率等方面的消耗,以延长设备的电池寿命或减少系统的总体能耗。
以下是一些常见的低功耗算法和技术:
1.动态电压和频率调整(DVFS):
-根据系统负载的变化,动态调整处理器的工作电压和频率,以在需要时提高性能,而在空闲时降低功耗。
2.电源门控(Power Gating):
-在设备的不同部分之间引入电源门,当某个部分不需要工作时,可以关闭其电源,从而降低功耗。
3.休眠模式和唤醒机制:
-设备在空闲或不使用的时候进入休眠模式,以减少功耗。
唤醒机制可在需要时迅速将设备从休眠状态唤醒。
4.数据缓存和局部存储优化:
-通过合理设计数据缓存和采用局部存储优化算法,减少对主存和外部存储器的访问,从而降低功耗。
5.传感器和通信模块的优化:
-通过降低传感器采样频率、优化通信协议、或采用更低功耗的通信模块,降低与外部设备的能耗。
6.任务调度和能量感知调度:
-通过智能任务调度算法,将任务集中在较短时间内的活跃模式中,以便更快地进入低功耗模式。
7.适应性电源管理:
-根据系统的工作状态和需求,采用适应性的电源管理策略,以最大程度地提供性能,并同时降低功耗。
这些低功耗算法通常需要在系统设计的早期考虑,并涉及硬件和软件方面的协同工作,以有效地降低整个系统的功耗。
stm32低功耗电路设计

stm32低功耗电路设计低功耗是当前电子设备设计的一个重要指标,它可以有效延长电池寿命,提高设备的可靠性,并对环境产生较小的影响。
在STM32嵌入式系统中,低功耗电路设计至关重要。
本文将介绍STM32低功耗电路设计的一些关键要点和注意事项。
首先,选择合适的供电方案是低功耗电路设计的基础。
在STM32中,一般有两种供电方式:外部供电和内部供电。
外部供电是指通过外部电源提供电压,而内部供电是指利用芯片内部的低功耗模式来降低功耗。
选择使用哪种供电方式需要根据设计要求来决定。
其次,对于外部供电模式,选择合适的电源管理IC或电池管理IC是重要的。
这些IC可以有效地对供电电路进行管理,并提高功耗转换的效率。
另外,对于电源线路的设计,应该尽量减小功耗,例如通过使用低电阻的电源线、使用高效的电源模块等方式。
在低功耗电路设计中,还需要注意处理器和外设的控制。
在处理器的选择上,可以使用带有低功耗模式的STM32系列芯片,这些芯片在空闲状态下能够在低电压和低频率下工作,从而降低功耗。
另外,对于外设的使用也需要注意功耗管理。
例如,通过合理配置SPI、UART等外设的时钟频率和工作模式,可以降低功耗。
此外,对于系统中的一些外设,可以考虑使用休眠模式来降低功耗。
休眠模式是指让某些外设进入低功耗模式,只在需要时才唤醒它们。
例如,可以通过配置RTC(实时时钟)和Wakeup Timer等模块来实现定时唤醒。
另外,对于一些不经常使用的外设,可以通过关闭它们来降低功耗。
最后,优化软件程序也是低功耗电路设计的重要内容。
在编写程序时,可以通过合理管理任务的优先级、使用低功耗模式的API函数等方式来降低功耗。
另外,对于一些循环任务,可以通过延时方式来减少功耗。
此外,确定好中断的触发条件和处理方式也是很重要的,可以减少不必要的中断触发和处理。
综上所述,STM32低功耗电路设计需要选择合适的供电方案,合理选择供电和电池管理IC,注意处理器和外设的控制,使用休眠模式来降低功耗,并优化软件程序。
嵌入式GIS系统软件的低功耗设计

嵌入式 G S成 r当前 G S发展 的一个热 门和重要研 究方 I I 向。它具有数据采集 、 地图浏览 、 信息检索 、 径分 析和地 路
形 分 析 等功 能 , 目前 已 经 在 城 市 智 能 交 通 系 统 (T ) 物 IS、
流配送系统 、 车辆导航及监控系统和数字化武器装备 等系 统 中得到广 泛应用 。嵌入式 G S系统设计除要求体积小 、 I
式 ; 空 闲 或 休 眠 模 在
式 , 旦 系 统 通 过 外 部 一
事件 被唤醒 , 则转入运
行 模 式 。如 此 反 复 , 构
成 如 图 1所 示 的 处 理 器工 作 模 式 切 换 图 。 图 1 处理器工作模式切换
寄存 器操作 和高速缓存等技术提高运 行效率 , 并采用 低电
值 差 别 较 大 。 以 Cru o i公 司 E 7 1( M7 ) i s gc r L P 2 1AR 核 嵌 入 式 处 理 器 为 例 , 发 手 册 中 写 到 , l 开 在 8MHz 作 频 率 工 下 , 行 时 消 耗 电 流 是 2 运 0mA, 闲 时 消 耗 电 流 是 6mA, 空 而 休 眠 时 消 耗 电 流 3 0g 0 A 全 动 态 切换 处 理 器 工 作 模 式 的 目 的 是 在 影 响 系 统
质 量 轻 和性 能好 外 , 功 耗 也 成 为 重 要 指 标 , 其 是 采 用 低 尤 电池 供 电 系统 的便 携 式 产 品 , 功 耗 设 计 还起 到 节 能 环 保 低
正常工作时 , 过软件控 制策略尽最大可能使嵌 入式处 理 通 器工作在空闲或者休眠模 式来 降低 系统功耗 。用户使 用
压 工 作模 式 以降 低 运 行 功 耗 。嵌 入 式 处 理 器 一 般 为 应 用 开发 提供 了 三 种 工 作 模 式 : 行 模 式 ( u ) 空 闲 模 式 运 R n、
低功耗设计方法

低功耗设计方法《低功耗设计方法》第一章绪论1.1 什么是低功耗设计低功耗设计是一种在满足设计要求的同时,将系统耗电量降至最低的一种技术。
它采取特定的设计技巧,在软件,硬件和系统上实现降功耗,以提高系统的能效比。
1.2 低功耗设计的重要性由于现代设备的日益发展,不断的功耗需求限制了其应用范围。
因此,低功耗设计日益受到重视,在移动器件的设计,尤其是电池供电的产品中,低功耗设计变得越来越重要。
低功耗设计的应用可以提高芯片的运行效率,减少耗电和热量的产生,使产品更加可靠和可维护。
第二章软件层低功耗设计2.1 指令优化指令优化是软件设计中最重要的一项,是用来减少存储器的访问次数,减少指令的数量,从而降低总的电源消耗。
指令的优化分析可以通过提高指令的执行速度和改善指令的执行顺序,减少内存的访问,以及改变指令编译器优化或减少指令的数量来实现。
2.2 其他软件层优化软件层的优化不仅仅是指令的优化,而且包括其他优化方法,如编译器优化、算法优化、芯片和(OS)操作系统内核的优化等。
其中,最关键的就是OS内核的优化,因为它涉及到整个系统的管理和控制。
第三章硬件层低功耗设计3.1 器件选择硬件层的低功耗设计是通过合理地合适器件来实现的。
包括最小化芯片面积,减少晶体管的数量,选择符合低功耗设计要求的低功耗元件,改善行宽号,缩小指令周期,选择最佳工作频率等。
3.2 供电电路设计供电电路设计是重要的低功耗设计之一,主要涉及电源的管理、供电等级变换、供电识别、供电补偿等技术。
如果能够使用一些电源芯片,可以减少系统的供电电路的复杂度,减少功耗损耗,提高系统的效率。
第四章小结低功耗设计是一种利用硬件及软件设计技术降低系统功耗的一项技术。
它采用特定的设计技巧,在软件,硬件,系统上实现降功耗,以达到提高系统能效比的目的。
在软件设计中,采用指令优化,编译器优化,算法优化,芯片优化等方法实现降功耗。
硬件设计方面,主要是器件选择及供电设计。
SoC设计方法与实现 第11章-低功耗设计 课件PPT

使用多种功耗状态的存储器管理。
低功耗SoC设计技术的综合考虑
低功耗技术对功耗与设计复杂度的影响
低功耗技术 漏电功耗的减小 静态功耗的减小 时序影响
面积优化
10%
10%
0%
多阙值工艺
CMOS工艺的发展与功耗的变化
各层次低功耗设计的效果
低功耗反馈的前向设计方法
SoC设计方法与实现
第十一章
低功耗
设计(2)
低功耗技术
内容大纲
减少静态功耗的技术 减少动态功耗的技术
减少静态功耗的技术
多阈值设计(Multi-Vt Design) 电源门控(Power Gating) 体偏置(Body Bias)
80%
0%
0%
时钟门控
0
20%
0%
多电压
50%
40%~50%
0%
电源门控
动态电压及动 态频率缩放
体偏置
90%~98% 50%~70%
90%
~0% 40%~70%
-
4%~8% 0% 10%
面积影响 -10% 2% 2% <10%
5%~15% <10% <10%
设计方法影响 无 低 低 中 中 高 高
验证复杂度影响 低 低 低 中 高 高 高
多阈值工艺
MOS管的阈值电压越小,速度越快,但漏电越大。
MOS管的阈值电压(Vt)与漏电流的关系
多阈值的设计流程
一种使用多阈值的设计流程
电源门控方法
用逻辑门电路控制模块电压的打开或关闭
电源门控方法
体偏置
智能硬件中的低功耗设计策略

智能硬件中的低功耗设计策略智能硬件已经成为了现代社会的重要组成部分,它们的出现与普及带来了许多便利和创新。
然而,由于大多数智能硬件需要长时间的运行和频繁的充电,低功耗设计成为了智能硬件设计中的重要考虑因素。
本文将探讨智能硬件中的低功耗设计策略。
1. 芯片级别的低功耗设计在智能硬件的设计中,芯片是核心组件之一,决定了整个硬件的性能和功耗表现。
为了实现低功耗设计,在芯片级别可以采取以下策略:(1)优化电源电压:通过将电源电压降低到最低限度,可以降低整个芯片的功耗。
例如,采用动态电压调整技术(DVC),能够根据芯片的工作负载自动调整电源电压,以达到节能的效果。
(2)降低时钟频率:将芯片的时钟频率降低到最低限度,能够有效降低功耗。
可以根据实际需求,动态地调整时钟频率,以平衡性能和功耗的要求。
(3)优化器件选择:选择功耗较低的器件,如低功耗微控制器(MCU)、低功耗传感器等。
这些器件在设计中已经经过了功耗优化,可以很好地满足低功耗要求。
2. 系统级别的低功耗设计除了芯片级别的低功耗设计,系统级别的设计也是实现低功耗的重要手段。
(1)优化功耗相关的软件算法:在设计智能硬件时,需要针对具体的应用场景进行功耗相关的软件算法优化。
通过合理利用睡眠模式、任务调度等技术,实现系统在低功耗状态下的工作。
(2)合理配置硬件模块的运行模式:智能硬件通常由多个模块组成,如屏幕、无线模块、感应器等。
在设计中,需要根据实际需求合理配置这些硬件模块的运行模式,避免不必要的功耗消耗。
(3)充电和能量管理:对于需要长时间运行的智能硬件来说,充电和能量管理是至关重要的。
合理设计充电模块和能量管理系统,可以提高电池的使用寿命,并有效降低功耗。
3. 优化用户交互界面用户交互界面是智能硬件与用户之间沟通的重要途径,也是功耗的一大来源。
因此,在设计用户交互界面时,需要采取措施降低功耗。
(1)优化背光和屏幕亮度:背光和屏幕亮度是屏幕功耗的主要来源,可以通过合理控制背光亮度和自动调节屏幕亮度的技术,来减少屏幕功耗。
《SoC底层软件低功耗系统设计与实现》记录

《SoC底层软件低功耗系统设计与实现》读书笔记目录一、书籍简介 (2)二、章节内容 (3)1. 低功耗系统设计基础 (4)1.1 低功耗设计的重要性 (5)1.2 低功耗设计的基本原则 (6)1.3 低功耗设计的技术范畴 (8)2. 低功耗设计方法与技术 (9)2.1 基于架构的低功耗设计 (11)2.2 基于算法的低功耗设计 (12)2.3 基于制程的低功耗设计 (13)2.4 基于架构、算法和制程的综合低功耗设计 (15)3. SoC底层软件低功耗实现 (16)3.1 SoC底层软件的低功耗设计策略 (17)3.2 基于处理器架构的底层软件低功耗实现 (18)3.3 基于芯片架构的底层软件低功耗实现 (20)3.4 基于操作系统级别的底层软件低功耗实现 (21)4. 具体案例分析 (23)4.1 案例一 (24)4.2 案例二 (25)4.3 案例三 (27)5. 总结与展望 (28)5.1 本书总结 (29)5.2 未来低功耗设计的发展趋势 (31)三、个人学习体会 (32)一、书籍简介本书详细探讨了在现代电子设备中,如何有效地管理和优化SoC 的功耗,以延长设备的电池寿命和提高整体性能。
本书不仅涵盖了理论知识,还结合了大量实际案例和工程实践,为读者提供了一个全面、系统的学习体验。
本书首先从SoC的基本概念开始介绍,帮助读者了解SoC在嵌入式系统中的重要地位和作用。
深入探讨了低功耗设计的重要性和必要性,阐述了在现代电子设备中,功耗管理已成为一个不可忽视的关键因素。
本书详细介绍了低功耗系统设计的原理、方法和技巧,包括电源管理、时钟管理、休眠模式设计、软硬件协同优化等方面的内容。
本书还介绍了与低功耗设计紧密相关的技术,如嵌入式操作系统、微控制器编程、硬件抽象层(HAL)和驱动开发等。
这些内容的介绍为读者提供了更为广泛的知识背景和视角,帮助读者更加深入地理解和应用所学知识。
《SoC底层软件低功耗系统设计与实现》是一本实用性强、内容丰富的书籍。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Software Power Measurement Dushyanth Narayanandnarayan@April26,2005Technical ReportMSR-TR-2005-51Microsoft ResearchMicrosoft CorporationOne Microsoft WayRedmond,WA98052AbstractEffective system-level power management requires cheap,accurate andfine-grained power measurement and accounting.Unfortunately current portable hardware does not provide this capability.We advocate software power measure-ment:estimation of power consumption by modelling it as a function of device state.The approach requires no additional hardware,and allowsfine-grained, per-device and per-application power measurement.We describe a design and implementation of software power measurement,and a feasibility study showing significantly better accuracy than power profiling based on time averaging.We conclude with design recommendations for OS designers and portable hardware vendors to improve the ease and accuracy of power measurement.1IntroductionEnergy is a critical resource for many computing systems.While battery life is especially relevant to portable and hand-held computers,peak power consump-tion affects fan noise on desktops and cooling costs for server farms.There is an increasingly recognised need to manage and account energy as afirst-class resource within the operating system[13].Energy management requires accurate measurement and accounting.Adap-tive tuning of device parameters such as disk spin-down timeouts[3]requires accurate estimates of per-device power consumption.Per-device measurements atfine time granularity—when combined with existing OS accounting of de-vices such as CPU,disk,and network—also enable per-application accounting of energy consumption.This is of great value both for end-users(“Outlook is responsible for80%of your battery drain,maybe you should kill it”)and for application-level adaptation[5].Unfortunately,current approaches to energy measurement have several draw-backs,especially when applied to laptop and hand-held computers.Accurate measurement withfine time granularity requires external hardware such as sam-pling digital multimeters,making the approach unwieldy and hard to deploy in thefield.Unmodified laptop hardware typically offers nothing more than Smart-Battery measurements,which are only accurate at coarse time granularities and measure the power consumption of the entire system but not of individual de-vices.We propose a novel technique known as software power measurement(SPM), which correlates infrequent,coarse-grained measurements of power withfine-grained observations of device state and activity.The result of the correlation is a predictor that estimates the energy consumption over arbitrarily short time interval from from the observed device state and activity.The remainder of this paper is organised as follows.Section2describes current approaches to the problem and their drawbacks.Section3describes the design and prototype implementation of software power measurement on Windows XP.Section4presents a quantitative evaluation of the prototype,1demonstrating both the feasibility of the approach and the limitations of the current implementation.Section5briefly describes related work,and Section6 concludes the paper.2State of the ArtCurrent approaches to power measurement are either impractical,expensive,or coarse-grained.They fall into one of three broad categories:On-board hardware:Many modern laptops and hand-helds can query battery drain information through the standard SmartBattery[11]interface.However, this does not provide per-device power consumption.Additionally,SmartBat-tery implementationsfilter the raw measurements before providing them to the BIOS,typically through averaging over some unspecified time period.This makes it impossible to get accurate measurements atfine time granularity. Multimeter-based sampling:Power usage can be sampled at high frequency by instrumenting the power supply of a portable computer with a multimeter[6]. However,multimeters are bulky,expensive,and impractical in thefield,and do not provide per-device power usage.Offline micro-benchmarks:Carefully designed micro-benchmarks followed by differential analysis can tell us the power cost of each device in each power state[2,7];we can then estimate instantaneous power consumption from the current state of each device.However,benchmarking each possible hardware platform and device is a tedious task.The approach we describe in this sec-tion can will construct such“power profiles”automatically,online,and in the background.Our aim is to design a power measurement strategy that is simultaneously •online:low-overhead,automated,continuously running in the background on end-user platforms.•SmartBattery-based:requiring no additional hardware on today’s laptop computers.•fine-grained:precise energy accounting to individual devices atfine time granularity.3Design and ImplementationHow can we get accurate,high-frequency,per-device power measurements with-out additional hardware?Software power measurement is based on the obser-vation that power consumption is a function of device state and device actions: CPU clock speed,disk spin-ups,etc.If we can identify all relevant states and actions,and correlate them to measured power at large time scales,then we can estimate power consumption at short time scales directly from the observed device states and actions.In other words,we can use device usage statistics as a proxy for power consumption,by2SmartBatteryDeviceState Figure 1:Power estimation from device state•tracking device actions and state changes•measuring SmartBattery statistics over relatively long time scales and matching the measurements to time-averaged device usage statistics.•modelling power consumption as a function of device state and activity by computing the energy cost E a of each device action a ,the power cost P s of each device state s ,and the background power consumption P bg .•estimating per-device consumption over any time interval t by applying the model to the observed device usage:E device = actions E a n a + statesP s t sHere n a is the number of times action a was observed,and t s is the amount of time spent in state s .The total power consumptionE total =P bg t + devicesE device•accounting this power to processes by accounting the underlying device usage.Figure 1shows graphically the relationship between device parameters,power consumption,and the resulting predictive model.Our current prototype models three devices of interest for power management on portable/laptop computers:CPU,disk,and display.Table 1shows the state variables and actions currently tracked for each device.Our implementation platform is Windows,and we use Event Tracing for Windows (ETW)[9]to track device behaviour.ETW is a low-overhead mecha-nism for tracing kernel and application events with cycle-accurate timestamps.3DeviceCPUSpeed(P)state)DiskSpin-up(action)DiskBrightness levelTable1:Device states tracked for power measurementCurrently it can track context switches,disk accesses,and network send/receive events,and attribute them to the appropriate process.We have added addi-tional events to the Windows kernel to track disk spin-ups and spin-downs,and changes in processor clock speed.For the LCD display,the main parameter of interest is the backlight state:whether it is on or off,and what the bright-ness level is.On our test platform,this information is not exposed to the OS from the vendor-specific binary video driver.In our feasibility study,we set the brightness level by hand,and provide the known brightness level as input to the model.While tracing is done on the live system,analysis and modelling are currently done offline using scripts that parse the event trace logs to track the state and activity of each device.Given precise time-stamped events for each state change, we know the power state of each device at each point in time.This information is correlated with SmartBattery measurements to compute the power cost of each individual device state as well as the baseline power consumption.The SmartBattery interface provides two ways to measure power consump-tion:1.Spot readings of battery drain current2.The current battery charge levelThus,we could measure average power consumption by averaging a series of spot readings,or by measuring the change in battery charge over time.Thefirst method has the disadvantage that certain power states can never be measured. For example,querying the SmartBattery interface cannot be done when the CPU is idle,thus we can never get spot readings when the CPU is in states C1,C2,or C3.A further disadvantage is that the spot readings are not really instantaneous,but are averaged over an unknown time duration specific to the proprietary vendor implementation of the SmartBattery interface.Without knowing the time period for which a power measurement is valid,it is impossible to know which device states it corresponds to.For these reasons,we measure power by tracking changes in battery charge level over time.We divide time into epochs,each corresponding to a measurable change in battery charge level.In our prototype,an epoch corresponds to an average battery drain of150mWh.The energy drain for each epoch is4chosen randomly from the range100–200mWh to avoid any correlation with periodic system events.Within each epoch,we measure the average amount of time spent by each device in each power state,as well as the average power consumption(the energy drain divided by the epoch length).This gives us one sample point for our model.By collecting a number of such samples,we derive the power/energy cost of each device state/action,and hence the energy consumed over any time interval for which all the device states and actions are known.4Feasibility studyOur evaluation of software power measurement was aimed at answering the following questions:•How does device state impact battery drain?•How accurate is software power measurement,compared to a scheme that ignores device state?•How does the accuracy change with the number of training samples?Our evaluation approach is to collect power samples with devices in different states and to derive the per-device state costs through linear regression.Ideally we would then validate these against the known power/energy costs of the device states and actions;however,these are not available on our hardware platform. Instead we validate our model by comparing its prediction of average epoch power with the measured value.In other words,given a series of epochs with known power consumption,we predict the average power consumption of a new epoch and compare that against the measured value.In general,learning power consumption as a function of device state would require us to test a large number of device state combinations.In our linear model,however,the power consumption of each device is independent of the state of other devices.Thus,we can explore the state space by varying one state variable at a time and keeping the others constant.Our evaluation platform was a Dell Latitude D600with a1.6GHz Mobile Pentium processor,running Windows XP modified to record device state tran-sition events as well as periodic measurements of battery charge level.The CPU power state was varied by modifying Windows power management to allow user-level control of the C-and P-states.This allowed us to set the P-state(CPU speed)to any one of12supported states(P0...P11).It also allowed us to force Windows to pick one particular C-state(C1,C2,or C3)when idle:the default scheme adaptively chooses the idle state depending on the recent idleness of the CPU.To reduce the number of experiments,our evaluation explores all four of the C-states but only two of the12P-states(P0and P5,corresponding to100% and37%of the maximum processor speed).Of the8possible screen states,we explore three:blank,brightness3,and brightness7.52040608010012014016002000400060008000Time (s)B a t t e r y d r a i n (k J )Figure 2:Differential power measurementUnfortunately,disk state is much more difficult to control.The disk power management interface only allows us to set idle timeouts for various state tran-sitions,and not to trigger state transitions directly.Further,the system disk on a Windows machine is accessed frequently,causing frequent transitions back to the high power state (D 0).Thus,it is impossible to observe the disk in a low power state for any significant period of time.Given these constraints,we only consider two states for the disk:•D 0:the highest-power state,disk is spun up and ready to read/write •No disk:we remove the disk and boot the machine from a network server Also,given the difficulty of controlling the number of spin-ups and spin-downs in an epoch,we do not include these in the current model,ensuring instead that the disk always spun-up when present.To explore the state space,we put the machine into one of 7configurations,and sampled the power consumption for an entire battery charge (i.e.fully charged to fully empty).The baseline configuration had the CPU at speed level P 0,the screen at level 3,and the disk in D 0.The CPU was running a synthetic,randomly varying workload with a mean utilisation of 65%.When idle,the state transitions were determined by the default Windows strategy,which selects C 1,C 2,or C 3depending on recent idleness.All the other configurations are variations on the baseline:•Screen level 7:Screen brightness 7,no CPU load60%5%10%15%20%25%0900180027003600Time (s)R e l a t i v e e r r o r (%)Figure 3:Accuracy of linear predictor•Screen blanked :Screen blanked,CPU load•No disk :Disk removed,no CPU load•CPU in P0,100%:CPU load of 100%•CPU in P5,100%:CPU load of 100%,speed 37%•CPU idle,C 1:No CPU load,states C 2and C 3disallowedFigure 2shows the energy drain in each of these configurations.We see that the rate of power consumption is constant for each configuration,but signifi-cantly different between configurations,indicating that power consumption is in fact highly correlated to device state.In practice,we would not want to drain the entire battery once for each configuration,but train our predictor on a smaller number of samples,switching device states periodically to explore the state space.We measured the effect of doing this by interleaving the samples from the seven traces,progressively updating the linear model at each step,and measuring the prediction error with respect to the next sample.Figure 3shows the accuracy of the SPM predictor over time,compared to AVE:a predictor that simply averages past samples to predict future power consumption without regard to device state.We see that the SPM predictor requires 5–10min of measurement to stabilise,and provides significantly bet-ter accuracy than AVE,with an RMS error that is 10–15%of the true value,compared to 20–25%for AVE.70%5%10%15%20%25%0900180027003600Time (s)R e l a t i v e e r r o r (%)Figure 4:Accuracy of smoothed linear predictorWe surmised that much of SPM’s error was due to noise in the underlying battery charge measurements.To test this hypothesis,we tested SPM against a smoothed version of the input data,by making the epochs 10times longer:each epoch in the smoothed set consists of 10consecutive epochs from the original analysis.Figure 4show that this significantly reduces the error of SPM to under 2%,while AVE continues to suffer from ignoring device state.The disadvantage of smoothing is that it takes longer to acquire samples and hence longer for the predictor to converge:epoch length is a tuning parameter that trades agility for stability.4.1LimitationsThe primary limitation on the SPM approach is the granularity of the underlying SmartBattery interface.The measurements available through this interface are coarse-grained both in time and in device-level scope.Further,the relationship between these measurements and the true power consumption (e.g.the period of time averaging)are vendor-specific and unknown.Some of these limitations can be alleviated by averaging power measurements over long time periods,at the cost of increasing the time to convergence.Our current prototype is limited in the number of device states and actions that it tracks and models.Most importantly,it does not model the wireless interface,a significant consumer of energy when mobile.Internal states of the wireless interface are often hidden from the operating system,making it hard to accurately correlate these states with power consumption.We also ignore8the energy consumption of memory subsystem activity,which is typically small compared to that of the entire system.Similarly,we do not include additional measurements such as Pentium event counters,which could provide more infor-mation about CPU power consumption than cycle counts[1],but would require a higher tracing overhead and a more complex model.Our current approach is based on offline benchmarks which explore the space of device power states.The linear regression algorithm itself is cheap,fast, and easily used in an online update mode instead.However,online operation presents other challenges.We are no longer free to explore the state space arbitrarily,since this will impact the functionality and performance seen by the user.Instead we must learn from the state changes occurring naturally as a result of user behaviour and OS adaptation,which may be only a small subset of the entire state space.This disadvantage could be overcome by running the energy benchmarks only when idle and on AC power,or at boot time,or when a new device or OS is installed.The cost models could also be initialized from a database of known power parameters for each device or device type,providing approximate power estimates while the true costs are being learned.Finally,our evaluation indicates the feasibility of the SPM approach,but does not validate the SPM predictions against real,fine-grained,per-device instantaneous power measurements such as those obtained from instrumented hardware.Such a comparison would let us calibrate the SPM approach on the lab bench before deploying it in thefield.5Related WorkSection2we described current approaches to power measurement;here we briefly describe work in the broader area of adaptive power management.Most work in adaptive power management focuses on dynamically setting a single resource to the lowest power state possible given some performance bound.Dynamic voltage scheduling for processors[4,8,12]reduces clock speed as much as possible without missing task deadlines.Similarly,adaptive disk spin-down[3]minimises disk spin-ups and time spent spun-up while bounding the impact on access latency.These approaches avoid explicit measurement or estimation of power consumption at runtime,and thus do not lend themselves to cross-resource adaptation decisions.For example,they cannot compare the energy benefit of slowing down the CPU to that of spinning down the disk.Energy is treated as an explicit,first-class system resource in ECOsys-tem[13].Each process’s energy usage is computed from its usage of CPU, disk,and network by consulting a power profile.SPM could generate or refine such power profiles automatically without requiring manual benchmarking or analysis.Previous work by the author and others[5,10]has shown that the energy consumption of an adaptive application can be learned as a hardware-specific function of its adaptive parameters.SPM can simplify this learning task by sep-arating out the hardware-specific portion:the mapping of resource consumption9to energy consumption.6ConclusionThis paper proposes software power measurement,a novel technique for cheap, accurate,andfine-grained estimation of power consumption on mobile comput-ers.Software power measurement is based on correlating device usage statistics to time-averaged power consumption,and using the resulting model to gener-ate estimates of instantaneous,per-device power consumption.Our evaluation shows that the device power state information available in the OS is highly corre-lated with,and thus a good predictor of,power consumption.It also shows that a simple and cheap linear model can learn this correlation with good accuracy.Based on our experience,we have the following recommendations for design-ers of laptop hardware such as“smart”batteries:•to provide unfiltered,unsmoothed power measurements to the OS where possible•if the samples arefiltered,to provide detailed information on thefiltering algorithm and the time constants involve•to equip each major hardware component(CPU,disk,PCI cards,etc.) with its own power measurement hardware such as as a gas-gauge chip We would also recommend that OS and device driver designers•expose all device state transitions and actions that affect power/energy consumption•provide interfaces for application-level control of device power state,al-lowing easy exploration of device power states and power management strategies.References[1] F.Bellosa.The benefits of event-driven energy accounting in power-sensitivesystems.In Proc.9th ACM SIGOPS European Workshop,Sept.2000.[2]T.Cignetti,K.Komarov,and C.Ellis.Energy estimation tools for the Palm.InProc.Ninth ACM Workshop on Modeling,Analysis and Simulation of Wireless and Mobile Systems(MSWiM’00),Aug.2000.[3] F.Douglis,P.Krishnan,and B.Bershad.Adaptive disk spin-down policies for mo-bile computers.In Proc.Second Symposium on Mobile and Location-Independent Computing(MLICS’94),Apr.1995.[4]K.Flautner and T.Mudge.Vertigo:Automatic performance-setting for Linux.InProc.5th Symposium on Operating Systems Design and Implementation(OSDI ’02),Dec.2002.10[5]J.Flinn and M.Satyanarayanan.Energy-aware adaptation for mobile applica-tions.In Proc.17th ACM Symposium on Operating Systems Principles(SOSP ’99),Dec.1999.[6]J.Flinn and M.Satyanarayanan.PowerScope:A tool for profiling the energyusage of mobile applications.In Proc.2nd IEEE Workshop on Mobile Computing Systems and Applications(WMCSA’99),Feb.1999.[7]J.R.Lorch and A.J.Smith.Apple Macintosh’s energy consumption.IEEEMicro,18(6),Nov./Dec.1998.[8]J.R.Lorch and A.J.Smith.Operating system modifications for task-based speedand voltage scheduling.In Proc.1st International Conference on Mobile Systems, Applications,and Services(MobiSys’03),May2003.[9]Microsoft.Event Tracing for Windows(ETW)./library/en-us/perfmon/base/event_tracing.asp,2002.[10] D.Narayanan,J.Flinn,and ing history to improve mo-bile application adaptation.In Proc.3rd IEEE Workshop on Mobile Computing Systems and Applicatons(WMCSA’00),Dec.2000.[11]SBS Implementers Forum.Smart Battery Data Specification,Revision1.1.http:///,Dec.1998.[12]M.Weiser,B.Welch,A.Demers,and S.Shenker.Scheduling for reduced CPUenergy.In Proc.First USENIX Symposium on Operating System Design and Implementation(OSDI’94),Nov.1994.[13]H.Zeng,C.S.Ellis,A.R.Lebeck,and A.Vahdat.ECOSystem:Managingenergy as afirst class operating system resource.In Proc.Tenth International Conference on Architectural Support for Programming Languages and Operating Systems(ASPLOS-X),Oct.2002.11。