是否可以在程序中提取指令的特定能耗? [英] Is it possible to extract instruction specific energy consumption in a program?

查看:108
本文介绍了是否可以在程序中提取指令的特定能耗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的意思是,给定一个源代码文件,是否可以使用诸如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);

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆