arXiv:2512.02738cs.PLcs.CL2025-12

为Java等静态类型JVM语言提供基于字节码的能耗概率预测方法

Probabilistic energy profiler for statically typed JVM-based programming languages

  • 基于字节码模式构建贝叶斯统计模型,实现能耗分布预测
  • 四因素模型涵盖数据大小、类型、操作及硬件平台,实测准确率高
  • 适用于开发者优化代码能耗,尤其适合系统级性能分析人员

能耗问题在移动设备和大型数据中心日益突出。开发者亟需软件能耗的详细数据以应对能耗挑战。现有方法多聚焦特定函数或程序,且仅通过点估计估算CPU能耗,忽略其他硬件影响,难以支持统计推断与可解释性。本文提出一种新方法,针对静态类型JVM语言(如Java、Scala),通过测量源代码语句对应的字节码模式能耗,构建基于贝叶斯统计的能耗预测模型。模型包含四个静态可得因素:数据大小、数据类型、操作类型及硬件平台(设备)。在Java上的实验表明,所有四因素均显著影响能耗,同型号设备间能耗存在差异,操作与数据类型导致明显消耗变化。预测结果与真实能耗高度吻合,验证了方法有效性。本工作为未来能耗验证工具提供了可复用的建模框架。

原文摘要 · Abstract (English)

Energy consumption is a growing concern in several fields, from mobile devices to large data centers. Developers need detailed data on the energy consumption of their software to mitigate consumption issues. Previous approaches have a broader focus, such as on specific functions or programs, rather than source code statements. They primarily focus on estimating the CPU's energy consumption using point estimates, thereby disregarding other hardware effects and limiting their use for statistical reasoning and explainability. We developed a novel methodology to address the limitations of measuring only the CPU's consumption and using point estimates, focusing on predicting the energy usage of statically typed JVM-based programming languages, such as Java and Scala. We measure the energy consumption of Bytecode patterns, the translation from the programming language's source code statement to their Java Bytecode representation. With the energy measurements, we construct a statistical model using Bayesian statistics, which allows us to predict the energy consumption through statistical distributions and analyze individual factors. The model includes three factors we obtain statically from the code: data size, data type, operation, and one factor about the hardware platform the code executes on: device. To validate our methodology, we implemented it for Java and evaluated its energy predictions on unseen programs. We observe that all four factors are influential, notably that two devices of the same model may differ in energy consumption and that the operations and data types cause consumption differences. The experiments also show that the energy prediction of programs closely follows the program's real energy consumption, validating our approach. Our work presents a methodology for constructing an energy model that future work, such as verification tools, can use for their energy estimates.

能耗分析贝叶斯模型JVM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。