Probabilistic Energy Profiler For Java
收藏资源简介:
Introduction The artifact contains the whole dataset and all code files used in the article "Probabilistic Energy Profiler for Java" by Joel Nyholm, Wojciech Mostowski, and Christoph Reichenbach. The paper aims to create an energy profiler for Java bytecode patterns, the translation of a Java code statement to its bytecode sequence. We focus on variable declarations and additions of the int, long, float, and double data types. All operations were executed on a Raspberry Pi 5, and their energy was measured using the Keithley 2602 SourceMeter. Hence, the data collection cannot easily be reproduced; one needs access to the measurement hardware. The dataset has three files: a class diagram for the benchmark harness, a VirtualBox image ("Debian.ova") and a compressed directory ("Data and code.zip"). The ZIP directory contains all the code and data used in the paper. The VM image also has this, and R, Rstudio, Java, and Python are installed to execute the code files. The VirtualBox image can, without external hardware, execute the Python script that converts the raw data (execution time, voltage, and current measurements) to a CSV file and calculates the operations' energy in Joules. The image can also execute the R script, to construct the Bayesian model and generate the plots in the paper. Executing experiments in the VM If needed the password for the vboxuser on the VM is "user" To run the Python script, use: python3 toCSV.pyThe script will construct a CSV file using directories in the "Raw Data" directory. The directory it will use as input data depends on the information on line 24 in toCSV.py. To run the R script, use:rstudio 'R scripts and data'/model.r Running the command above will open Rstudio, where the probabilistic model used in the paper is pre-loaded.To execute the code to get all plots, do the following in Rstudio:Alt+Ctrl+Rorpress Code > Run Region > Run All in the taskbar The construction of the Bayesian model is commented out; if you wish to rebuild the model, you must remove the comments (#) in lines 289-296. Code files/directories Java Code (benchmark harness) In ClassDiagram.png, you can see the class diagram for the Java code. The Main class is the entry point for the benchmark harness. It uses the Addition, Variable, TestIntAdd, TestIntVarDecl, and TestBytecodeSequence classes. The classes starting with Test contain the code used to test against the Bayesian model's predictions. The Addition and Variable class contains the microbenchmarks for creating the Bayesian model. The Bytecode class handles the execution ordering and execution of these microbenchmarks. The Multimeter and its subclass Keithley2602 handle communication with the Keithley2602 SourceMeter through RS-232. Scripts There exists three scripts in the Data and Code directory: CPU_counter_test.sh: Executes the benchmark harness and gives counters for L1 caches and the branch predictor (uses external equipment) run_Java_profiler.sh: Executes the benchmark harness (External hardware is needed) toCSV.py: Converts the execution time, voltage and amperage data into a CSV file containing Joules In the R scripts and data directory there are an additional two script files and one data file (model_data.RData) that contains the data used for the paper: model.R: The R code for executing the Bayesian model and representing its results with plots model-non-centered.stan: The Stan code that constructs the Bayesian model Data directories The "Data and code" directory contains two folders containing the data for the experiment. The Raw data directory contains six directories, each with execution time, voltage, and amperage results and one CSV file: results_50additions: Contains results for 50 additions (TestIntAdd) in growing order: 1 addition, 2 additions, ..., 50 additions results_50Vardecl: Contains results for 50 variable declarations (TestIntVarDecl) in growing order: 1 declaration, 2 declarations, ..., 50 declarations results_pi5_dev1: Contains the results from executing the microbenchmarks (addition and variable declarations) for device 1 results_pi5_dev1: Contains the results from executing the microbenchmarks (addition and variable declarations) for device 2 results_testfunctions_dev2: Contains the results from executing the TestBytecodeSequence for device 1 results_testfunctions_dev1: Contains the results from executing the TestBytecodeSequence for device 2 perfData.csv: Contains the counters for the L1 cache and branch misses The R scripts and data directory have the aggregated data from each directory above (obtained by the toCSV.py script) as a CSV file. However, two folders exist for the "results_testfunction" and "results_pi5" directories, one for each device in the experiment. The data for these are contained in one file, results_testfunction.csv for the "results_testfunction" directories and results.csv for the "results_pi5" directories. Checksums Data and code.zip: SHA256: 56caf51be85b0d5f509c15856771246c7f9028069955d38087ba5c9d1ed839f8md5: b1ba3b958df0e14c3d8519a3889d9e50 Debian.ova: SHA256: bbe556653a5fd204c4d29dd09967dd1897aa9268bb917a2ab33545906defc2e6md5: 2ec5a82b27006038b2a07b004ac0fa70
引言 本附属材料包含Joel Nyholm、Wojciech Mostowski及Christoph Reichenbach所撰论文《面向Java的概率能耗分析器》(*Probabilistic Energy Profiler for Java*)中使用的全部数据集与代码文件。 该论文旨在针对Java字节码(Java bytecode)模式——即Java代码语句转换为字节码序列的过程——构建一款能耗分析器,研究重点涵盖int、long、float及double数据类型的变量声明与加法操作。所有实验均在树莓派5(Raspberry Pi 5)上执行,能耗数据通过吉时利2602源测量单元(Keithley 2602 SourceMeter)采集。因此,本数据集的复现存在一定难度,需具备专用的测量硬件方可开展。 本数据集包含三个文件:基准测试框架的类图、VirtualBox虚拟机镜像("Debian.ova")以及压缩目录"Data and code.zip"。该ZIP压缩目录包含论文中使用的全部代码与数据;虚拟机镜像同样内置了这些内容,且预装了R、RStudio、Java与Python环境,可直接运行代码文件。 无需外接硬件,即可通过该VirtualBox镜像运行Python脚本,将原始数据(执行时长、电压与电流测量值)转换为CSV文件,并计算各操作的焦耳级能耗。该镜像还可运行R脚本,用于构建贝叶斯模型并生成论文中的图表。 # 虚拟机内实验执行流程 若有需要,虚拟机内vboxuser用户的密码为"user"。 运行Python脚本的命令为:python3 toCSV.py 该脚本将通过"Raw Data"目录下的子目录生成CSV文件,其读取的输入数据目录由toCSV.py第24行的配置决定。 运行R脚本的命令为:rstudio 'R scripts and data'/model.r 执行上述命令将打开RStudio,其中已预加载论文中使用的概率模型。若需获取全部图表,可在RStudio中执行以下操作:按下Alt+Ctrl+R组合键,或在任务栏依次点击「代码 > 运行区域 > 全部运行」。 贝叶斯模型的构建代码已被注释;若需重新构建模型,需移除第289-296行的注释符(#)。 # 代码文件与目录 ## Java代码(基准测试框架) 在ClassDiagram.png中可查看Java代码的类图。其中Main类为基准测试框架的入口点,其依赖Addition、Variable、TestIntAdd、TestIntVarDecl及TestBytecodeSequence类。以Test开头的类包含用于验证贝叶斯模型预测的测试代码;Addition与Variable类包含用于构建贝叶斯模型的微基准测试代码;Bytecode类负责管理这些微基准测试的执行顺序与执行流程;Multimeter及其子类Keithley2602通过RS-232接口与吉时利2602源测量单元(Keithley 2602 SourceMeter)实现通信。 ## 脚本文件 在Data and code目录下包含三个脚本: 1. CPU_counter_test.sh:执行基准测试框架,并采集L1缓存与分支预测器的计数器数据(需外接专用设备) 2. run_Java_profiler.sh:执行基准测试框架(需外接专用硬件) 3. toCSV.py:将执行时长、电压与电流数据转换为包含焦耳能耗的CSV文件 在R scripts and data目录下另有两个脚本文件与一个数据文件model_data.RData,该数据文件包含论文中使用的实验数据: - model.R:用于执行贝叶斯模型并以图表展示其结果的R代码 - model-non-centered.stan:用于构建贝叶斯模型的Stan代码 ## 数据目录 Data and code目录包含两个存放实验数据的子目录。Raw data目录包含六个子目录,每个子目录均存储有执行时长、电压与电流测量结果,以及一个CSV文件: 1. results_50additions:存储50次加法操作(TestIntAdd)的测试结果,按加法次数递增排列:1次加法、2次加法……50次加法 2. results_50Vardecl:存储50次变量声明(TestIntVarDecl)的测试结果,按声明次数递增排列:1次声明、2次声明……50次声明 3. results_pi5_dev1:存储设备1的微基准测试(加法与变量声明)结果 4. results_pi5_dev2:存储设备2的微基准测试(加法与变量声明)结果 5. results_testfunctions_dev2:存储设备1执行TestBytecodeSequence的测试结果 6. results_testfunctions_dev1:存储设备2执行TestBytecodeSequence的测试结果 7. perfData.csv:存储L1缓存与分支缺失的计数器数据 R scripts and data目录包含通过toCSV.py脚本从上述各目录聚合得到的CSV格式数据。此外,该目录下另有两个对应实验设备的子目录,分别对应results_testfunction与results_pi5目录:前者的聚合数据存储于results_testfunction.csv,后者的聚合数据存储于results.csv。 # 校验和 - Data and code.zip:SHA256: 56caf51be85b0d5f509c15856771246c7f9028069955d38087ba5c9d1ed839f8;MD5: b1ba3b958df0e14c3d8519a3889d9e50 - Debian.ova:SHA256: bbe556653a5fd204c4d29dd09967dd1897aa9268bb917a2ab33545906defc2e6;MD5: 2ec5a82b27006038b2a07b004ac0fa70



