本文介绍了是否可以在程序中提取指令的特定能耗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的意思是,给定一个源代码文件,是否可以使用诸如perf之类的工具来提取特定代码块或1条单指令的能耗水平?
What i mean is that given a source code file is it possible to extract energy consumption levels for a particular code block or 1 single instruction, using a tool like perf?
推荐答案
使用 jRAPL 一个用于概要分析运行在CPU上的Java程序的框架.
Use jRAPL which is a framework for profiling Java programs running on CPUs.
例如,以下代码段尝试测量任何代码块的能耗,这些代码块的值是开始和结束之间的差值:
For example, the following code snippet attempts to measure the energy consumption of any code block, whose value is the difference between beginning and end:
double beginning = EnergyCheck.statCheck();
doWork();
double end = EnergyCheck.statCheck();
System.out.println(end - beginning);
http://gustavopinto.org/lost+found/fase2015.pdf
这篇关于是否可以在程序中提取指令的特定能耗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!