项目 / sosy-lab/cpu-energy-meter

sosy-lab/cpu-energy-meter

行业推荐
语言 C标签 raplenergyresource-measurementlinux数据更新 2026-11-13 19:42:00 · 仓库 2026-10-18

一段话介绍

CPU Energy Meter 是一套 Linux 工具,用来以较细的时间粒度监测 Intel CPU 的能耗,覆盖封装(CPU 插座)、核心、非核心、内存节点(仅服务器 CPU)以及平台等功耗域。它利用 Intel 的 RAPL(Running Average Power Limit)特性,该特性从 Sandy Bridge 一代及之后的处理器起可用。工具采用硬件允许的最大测量间隔,源文说明由此带来的开销可忽略。它由慕尼黑大学软件系统实验室在 Intel Power Gadget 基础上分叉开发。Debian 或 Ubuntu 可通过项目 PPA 或 GitHub 发行包安装,也可按文档从源码编译。说明见[仓库 README](https://github.com/sosy-lab/cpu-energy-meter)。

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
A tool for measuring energy consumption of Intel CPUs
348累计星
31Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

能耗监测与能效优化

适配系统:能源管理系统、能耗监测平台 · 得分 1.4

面向能耗采集与负荷分析建模,可用于园区/楼宇能效诊断与用能优化建议。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
在 Debian 或 Ubuntu 上,最简便的安装方式是通过 PPA 添加仓库安装 CPU Energy Meter。
特点或设计要点
运行 `cpu-energy-meter` 后,工具在后台累计受支持 CPU 的能耗,收到 SIGINT(Ctrl+C)时输出各域的焦耳读数;发送 `USR1` 可得到中间结果,`-r` 可改为易于解析的原始列表。默认会自动计算测量间隔,也可用 `-e` 覆盖。发行包会完成权限配置,使普通用户也可运行;从源码运行时需加载 `msr` 等内核模块,并按文档设置能力与设备访问权限。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-05-26 · 语言 C · 贡献者 —
c

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 5,741 字节。

<!--
This file is part of CPU Energy Meter,
a tool for measuring energy consumption of Intel CPUs:
https://github.com/sosy-lab/cpu-energy-meter

SPDX-FileCopyrightText: 2012 Intel Corporation
SPDX-FileCopyrightText: 2015-2021 Dirk Beyer <https://www.sosy-lab.org>

SPDX-License-Identifier: BSD-3-Clause
-->

CPU Energy Meter
================

[![Build Status](https://gitlab.com/sosy-lab/software/cpu-energy-meter/badges/main/pipeline.svg)](https://gitlab.com/sosy-lab/software/cpu-energy-meter/pipelines)
[![BSD-3-Clause License](https://img.shields.io/badge/license-BSD--3--clause-brightgreen.svg)](https://github.com/sosy-lab/cpu-energy-meter/blob/main/LICENSE)
[![Releases](https://img.shields.io/github/release/sosy-lab/cpu-energy-meter.svg)](https://github.com/sosy-lab/cpu-energy-meter/releases)
[![DOI via Zenodo](https://zenodo.org/badge/46493895.svg)](https://zenodo.org/badge/latestdoi/46493895)


CPU Energy Meter is a Linux tool that allows to monitor power consumption of Intel CPUs
at fine time granularities (few tens of milliseconds).
Power monitoring is available for the following power domains:
- per package domain (CPU socket)
- per core domain (all the CPU cores on a package)
- per uncore domain (uncore components, e.g., integrated graphics on client CPUs)
- per memory node (memory local to a package, server CPUs only)
- per platform (all devices in the platform that receive power from integrated
  power delivery mechanism, e.g., processor cores, SOC, memory, add-on or
  peripheral devices)

To do this, the tool uses a feature of Intel CPUs that is called [RAPL (Running Average Power Limit)](https://en.wikipedia.org/wiki/Running_average_power_limit),
which is documented in the [Intel Software Developers Manual](https://software.intel.com/en-us/articles/intel-sdm), Volume 3B Chapter 14.9.
RAPL is available on CPUs from the generation [Sandy Bridge](https://en.wikipedia.org/wiki/Sandy_Bridge) and later.
Because CPU Energy Meter uses the maximal possible measurement interval
(depending on the hardware this is between a few minutes and an hour),
it causes negligible overhead.

CPU Energy Meter is a fork of the [Intel Power Gadget](https://software.intel.com/en-us/articles/intel-power-gadget-20)
and developed at the [Software Systems Lab](https://www.sosy-lab.org)
of the [Ludwig-Maximilians-Universität München (LMU Munich)](https://www.uni-muenchen.de)
under the [BSD-3-Clause License](https://github.com/sosy-lab/cpu-energy-meter/blob/main/LICENSE).
An [article describing CPU Energy Meter](https://doi.org/10.1007/978-3-030-45237-7_8) was published 2020.


Installation
------------

For Debian or Ubuntu the easiest way is to install from our [PPA](https://launchpad.net/~sosy-lab/+archive/ubuntu/benchmarking):

    sudo add-apt-repository ppa:sosy-lab/benchmarking
    sudo apt install cpu-energy-meter

Alternatively, you can download our `.deb` package from [GitHub](https://github.com/sosy-lab/cpu-energy-meter/releases)
and install it with `apt install ./cpu-energy-meter*.deb`.

Dependencies of CPU Energy Meter are [libcap](https://sites.google.com/site/fullycapable/),
which is available on most Linux distributions in package `libcap` (e.g., Fedora)
or `libcap2` (e.g, Debian and Ubuntu: `sudo apt install libcap2`),
and a Linux kernel with the MSR module (available by default)

Alternatively, for running CPU Energy Meter from source (quick and dirty):

    sudo apt install libcap-dev
    sudo modprobe msr
    make
    sudo ./cpu-energy-meter

It is also possible (and recommended) to run CPU Energy Meter without root.
To do so, the following needs to be done:

- Load kernel modules `msr` and `cpuid`.
- Add a group `msr`.
- Add a Udev rule that grants access to `/dev/cpu/*/msr` to group `msr` ([example](https://github.com/sosy-lab/cpu-energy-meter/blob/main/debian/additional_files/59-msr.rules)).
- Run `chgrp msr`, `chmod 2711`, and `setcap cap_sys_rawio=ep` on the binary (`make setup` is a shortcut for this).

The provided Debian package in our [PPA](https://launchpad.net/~sosy-lab/+archive/ubuntu/benchmarking)
and on [GitHub](https://github.com/sosy-lab/cpu-energy-meter/releases) does these steps automatically
and lets all users execute CPU Energy Meter.

How to use it
-------------

    cpu-energy-meter [-d] [-e sampling_delay_ms] [-r]

The tool will continue counting the cumulative energy use of all supported CPUs
in the background and will report a key-value list of its measurements when it
receives SIGINT (Ctrl+C):

```
+--------------------------------------+
| CPU-Energy-Meter            Socket 0 |
+--------------------------------------+
Duration                  2.504502 sec
Package                   3.769287 Joule
Core                      0.317749 Joule
Uncore                    0.010132 Joule
DRAM                      0.727783 Joule
PSYS                     29.792603 Joule
```

To get intermediate measurements, send signal `USR1` to the process.

Optionally, the tool can be executed with parameter `-r`
to print the output as a raw (easily parsable) list:

```
cpu_count=1
duration_seconds=3.241504
cpu0_package_joules=4.971924
cpu0_core_joules=0.461182
cpu0_uncore_joules=0.053406
cpu0_dram_joules=0.953979
cpu0_psys_joules=38.904785
```

The parameter `-d` adds debug output.
By default, CPU Energy Meter computes the necessary measurement interval automatically,
this can be overridden with the parameter `-e`.

### Literature

- [CPU Energy Meter: A Tool for Energy-Aware Algorithms Engineering](https://doi.org/10.1007/978-3-030-45237-7_8), by D. Beyer and P. Wendler. In Proc. TACAS 2020, part 2, LNCS 12079, pages 126-133, 2020. Springer. [doi:10.1007/978-3-030-45237-7_8](https://doi.org/10.1007/978-3-030-45237-7_8) (open access)
↑