arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.00504cs.SE
收藏

EnCoDe:设计时源代码能耗估计

EnCoDe: Energy Estimation of Source Code At Design-Time

IIIT Hyderabad(印度理工学院海得拉巴分校)

Shailender Goyal, Akhila Matathammal, Karthik Vaidhyanathan

AI总结:

EnCoDe提出设计时细粒度能耗估计方法,通过PowerLens实现小代码块亚毫秒级能耗测量,并基于Python代码块的实证研究建立首个细粒度能耗数据集,利用机器学习模型实现设计时能耗预测与分类。

摘要:

能耗效率已成为软件质量的重要属性,对环境可持续性和运营成本有重要影响。然而,现有性能分析工具仅在运行时进行粗粒度测量,通常捕获进程或方法级别的能耗。此类工具无法揭示如函数、循环和条件等小代码块对能耗的贡献,阻碍开发者在设计时对编程构造的能耗效率进行推理和比较。为解决这一缺口,我们提出EnCoDe,一种设计时细粒度能耗估计方法,其核心贡献包括:(1) PowerLens,一种新型测量方法,可为小代码块提供可靠的亚毫秒级能耗读数;(2) 对超过18000个Python程序中提取的代码块进行广泛实证研究,揭示能耗与静态代码特征如结构、复杂度、密度和上下文特征之间的线性和非线性关系,产生首个细粒度数据集;(3) 预测建模,其中机器学习模型在这些特征上进行训练,以在设计时准确估计和分类块级能耗。我们的结果表明,块级估计稳定且可重复,回归器达到R²=0.75,分类器在识别能耗热点方面准确率达80.6%,使开发者能够在开发早期定位和解决低效代码区域,而无需执行。

英文摘要:

Energy efficiency has emerged as a vital attribute of software quality, with significant implications for both environmental sustainability and operational costs. However, existing profiling tools operate only at runtime and coarse granularity, typically capturing energy at the process or method level. Such tools fail to expose how small code blocks, such as functions, loops, and conditionals, contribute to energy consumption, preventing developers from reasoning about and comparing the energy efficiency of programming constructs during design-time. To address this gap, we propose EnCoDe, a methodology for fine-grained, design-time energy estimation, with the following key contributions: (1) PowerLens, a novel measurement methodology that achieves reliable sub-millisecond energy readings for small code blocks; (2) Extensive empirical study on code blocks extracted from over 18,000 Python programs, uncovering linear and non-linear relationships between energy consumption and static code features such as structural, complexity, density, and contextual characteristics, resulting in a first-of-its-kind fine-grained dataset; and (3) Predictive modeling, in which machine learning models are trained on these features to accurately estimate and classify block-level energy consumption at design-time. Our results demonstrate stable, reproducible block-level estimations, with regressors achieving R^2 = 0.75 and classifiers achieving 80.6% accuracy in identifying energy hotspots, enabling developers to localize and address inefficient code regions early in the development process without execution.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑