软件低功耗设计
- 格式:pdf
- 大小:173.73 KB
- 文档页数:12
低功耗设计的原理低功耗设计是指通过降低电路或系统的功耗,以实现更长的电池续航时间或更少的能源消耗。
在如今电池寿命短、能源供应有限的背景下,低功耗设计变得越来越重要。
下面将从电源管理、电路设计和软件优化等方面介绍低功耗设计的原理。
一、电源管理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中,一般有两种供电方式:外部供电和内部供电。
外部供电是指通过外部电源提供电压,而内部供电是指利用芯片内部的低功耗模式来降低功耗。
选择使用哪种供电方式需要根据设计要求来决定。
其次,对于外部供电模式,选择合适的电源管理IC或电池管理IC是重要的。
这些IC可以有效地对供电电路进行管理,并提高功耗转换的效率。
另外,对于电源线路的设计,应该尽量减小功耗,例如通过使用低电阻的电源线、使用高效的电源模块等方式。
在低功耗电路设计中,还需要注意处理器和外设的控制。
在处理器的选择上,可以使用带有低功耗模式的STM32系列芯片,这些芯片在空闲状态下能够在低电压和低频率下工作,从而降低功耗。
另外,对于外设的使用也需要注意功耗管理。
例如,通过合理配置SPI、UART等外设的时钟频率和工作模式,可以降低功耗。
此外,对于系统中的一些外设,可以考虑使用休眠模式来降低功耗。
休眠模式是指让某些外设进入低功耗模式,只在需要时才唤醒它们。
例如,可以通过配置RTC(实时时钟)和Wakeup Timer等模块来实现定时唤醒。
另外,对于一些不经常使用的外设,可以通过关闭它们来降低功耗。
最后,优化软件程序也是低功耗电路设计的重要内容。
在编写程序时,可以通过合理管理任务的优先级、使用低功耗模式的API函数等方式来降低功耗。
另外,对于一些循环任务,可以通过延时方式来减少功耗。
此外,确定好中断的触发条件和处理方式也是很重要的,可以减少不必要的中断触发和处理。
综上所述,STM32低功耗电路设计需要选择合适的供电方案,合理选择供电和电池管理IC,注意处理器和外设的控制,使用休眠模式来降低功耗,并优化软件程序。
低功耗设计方法《低功耗设计方法》第一章绪论1.1 什么是低功耗设计低功耗设计是一种在满足设计要求的同时,将系统耗电量降至最低的一种技术。
它采取特定的设计技巧,在软件,硬件和系统上实现降功耗,以提高系统的能效比。
1.2 低功耗设计的重要性由于现代设备的日益发展,不断的功耗需求限制了其应用范围。
因此,低功耗设计日益受到重视,在移动器件的设计,尤其是电池供电的产品中,低功耗设计变得越来越重要。
低功耗设计的应用可以提高芯片的运行效率,减少耗电和热量的产生,使产品更加可靠和可维护。
第二章软件层低功耗设计2.1 指令优化指令优化是软件设计中最重要的一项,是用来减少存储器的访问次数,减少指令的数量,从而降低总的电源消耗。
指令的优化分析可以通过提高指令的执行速度和改善指令的执行顺序,减少内存的访问,以及改变指令编译器优化或减少指令的数量来实现。
2.2 其他软件层优化软件层的优化不仅仅是指令的优化,而且包括其他优化方法,如编译器优化、算法优化、芯片和(OS)操作系统内核的优化等。
其中,最关键的就是OS内核的优化,因为它涉及到整个系统的管理和控制。
第三章硬件层低功耗设计3.1 器件选择硬件层的低功耗设计是通过合理地合适器件来实现的。
包括最小化芯片面积,减少晶体管的数量,选择符合低功耗设计要求的低功耗元件,改善行宽号,缩小指令周期,选择最佳工作频率等。
3.2 供电电路设计供电电路设计是重要的低功耗设计之一,主要涉及电源的管理、供电等级变换、供电识别、供电补偿等技术。
如果能够使用一些电源芯片,可以减少系统的供电电路的复杂度,减少功耗损耗,提高系统的效率。
第四章小结低功耗设计是一种利用硬件及软件设计技术降低系统功耗的一项技术。
它采用特定的设计技巧,在软件,硬件,系统上实现降功耗,以达到提高系统能效比的目的。
在软件设计中,采用指令优化,编译器优化,算法优化,芯片优化等方法实现降功耗。
硬件设计方面,主要是器件选择及供电设计。
智能硬件中的低功耗设计策略智能硬件已经成为了现代社会的重要组成部分,它们的出现与普及带来了许多便利和创新。
然而,由于大多数智能硬件需要长时间的运行和频繁的充电,低功耗设计成为了智能硬件设计中的重要考虑因素。
本文将探讨智能硬件中的低功耗设计策略。
1. 芯片级别的低功耗设计在智能硬件的设计中,芯片是核心组件之一,决定了整个硬件的性能和功耗表现。
为了实现低功耗设计,在芯片级别可以采取以下策略:(1)优化电源电压:通过将电源电压降低到最低限度,可以降低整个芯片的功耗。
例如,采用动态电压调整技术(DVC),能够根据芯片的工作负载自动调整电源电压,以达到节能的效果。
(2)降低时钟频率:将芯片的时钟频率降低到最低限度,能够有效降低功耗。
可以根据实际需求,动态地调整时钟频率,以平衡性能和功耗的要求。
(3)优化器件选择:选择功耗较低的器件,如低功耗微控制器(MCU)、低功耗传感器等。
这些器件在设计中已经经过了功耗优化,可以很好地满足低功耗要求。
2. 系统级别的低功耗设计除了芯片级别的低功耗设计,系统级别的设计也是实现低功耗的重要手段。
(1)优化功耗相关的软件算法:在设计智能硬件时,需要针对具体的应用场景进行功耗相关的软件算法优化。
通过合理利用睡眠模式、任务调度等技术,实现系统在低功耗状态下的工作。
(2)合理配置硬件模块的运行模式:智能硬件通常由多个模块组成,如屏幕、无线模块、感应器等。
在设计中,需要根据实际需求合理配置这些硬件模块的运行模式,避免不必要的功耗消耗。
(3)充电和能量管理:对于需要长时间运行的智能硬件来说,充电和能量管理是至关重要的。
合理设计充电模块和能量管理系统,可以提高电池的使用寿命,并有效降低功耗。
3. 优化用户交互界面用户交互界面是智能硬件与用户之间沟通的重要途径,也是功耗的一大来源。
因此,在设计用户交互界面时,需要采取措施降低功耗。
(1)优化背光和屏幕亮度:背光和屏幕亮度是屏幕功耗的主要来源,可以通过合理控制背光亮度和自动调节屏幕亮度的技术,来减少屏幕功耗。
《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底层软件低功耗系统设计与实现》是一本实用性强、内容丰富的书籍。
芯片设计中的低功耗技术有何创新在当今科技飞速发展的时代,芯片作为电子设备的核心组件,其性能和功耗一直是人们关注的焦点。
随着移动设备、物联网等应用的普及,对芯片的低功耗要求越来越高。
为了满足这些需求,芯片设计领域不断涌现出各种创新的低功耗技术,为电子设备的续航能力和性能提升带来了新的突破。
一、工艺制程的优化芯片制造工艺的不断进步是实现低功耗的重要基础。
更小的制程节点意味着晶体管的尺寸更小,导通电阻更低,从而能够降低静态功耗和动态功耗。
例如,从 28 纳米制程到 7 纳米制程,芯片的功耗大幅降低。
同时,先进的制程还能够提高晶体管的开关速度,减少信号传输的延迟,从而在提高性能的同时降低功耗。
然而,工艺制程的进步并非一帆风顺。
随着制程越来越小,面临的技术挑战也越来越多,如漏电问题、量子效应等。
为了解决这些问题,芯片制造商们不断研发新的材料和工艺,如采用高介电常数材料、金属栅极技术等,以进一步优化芯片的功耗性能。
二、电源管理技术的创新电源管理是芯片低功耗设计中的关键环节。
动态电压频率调整(DVFS)技术是一种常见的电源管理方法,它根据芯片的工作负载实时调整电压和频率,在负载较低时降低电压和频率,从而减少功耗。
例如,在智能手机中,当处理器处理简单任务时,DVFS 技术会降低其工作频率和电压,以节省电量。
此外,电源门控技术也是一种有效的电源管理手段。
通过关闭暂时不使用的电路模块的电源,可以显著降低静态功耗。
这种技术在芯片处于待机状态或部分模块闲置时能够发挥重要作用,有效延长电池续航时间。
三、架构设计的优化芯片的架构设计对功耗有着重要影响。
采用精简指令集(RISC)架构相对于复杂指令集(CISC)架构,通常能够减少指令执行的功耗。
此外,多核架构的出现使得芯片能够在不同的核心上处理不同的任务,根据负载灵活分配计算资源,从而提高能效比。
在存储架构方面,缓存层次结构的优化也能够降低功耗。
合理设计缓存的大小、命中率和替换策略,可以减少对主存的访问次数,降低访存功耗。
低功耗解决方案摘要随着电子设备越来越普及,对电池寿命和能效的需求也越来越高。
在许多应用中,如移动设备、物联网、无线传感器网络等,低功耗解决方案成为了一项重要的技术挑战。
本文将介绍一些常见的低功耗解决方案,包括功耗优化设计和节能技术。
1. 低功耗设计原则在设计低功耗解决方案之前,我们首先需要了解一些低功耗设计的基本原则,以便能够更好地理解后面所介绍的具体解决方案。
1.1. 降低工作频率降低工作频率是降低功耗的常用方法之一。
通过降低处理器的时钟频率,可以有效地减少功耗。
但需要注意的是,在降低频率的同时也会带来性能的下降。
1.2. 优化算法优化算法是指通过改进代码或者算法,使得程序在相同任务完成的情况下能够消耗更少的功耗。
例如,优化循环结构、避免不必要的计算等都可以减少功耗。
1.3. 降低电压降低工作电压是降低功耗的一种常用方法。
通常来说,功耗与电压平方成正比。
通过降低电压,可以显著降低功耗,但需要注意的是,电压过低可能会导致设备性能下降,因此需要在功耗和性能之间权衡。
1.4. 休眠模式休眠模式是指在设备空闲时将其进入低功耗状态,以减少功耗。
通过将部分或全部组件关闭或进入低功耗模式,可以显著减少功耗。
但需要注意的是,在进入休眠模式和唤醒之间的切换也会有一定的功耗。
2. 低功耗解决方案2.1. 架构优化在电子设备的设计中,使用合适的架构是实现低功耗的基本前提。
一些常见的架构优化方法包括:•简化电路结构:减少电路的复杂度,降低功耗。
•集成多个功能单元:将多个功能单元集成到一个芯片上,减少芯片间的数据传输,降低功耗。
•芯片级功耗分析:通过对芯片级功耗进行分析和优化,实现低功耗设计。
2.2. 芯片级优化在芯片级别上进行优化是实现低功耗的重要手段之一。
一些常见的芯片级优化方法包括:•压缩指令集:通过压缩指令集,减少存储空间和数据传输量,从而降低功耗。
•功耗管理单元:添加功耗管理单元,通过调整芯片工作状态和电压,实现动态功耗管理。
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。