perf 编辑

perf is a powerful system-wide instrumentation service that is part of Linux. This article discusses how it can be relevant to power profiling.

Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand.

Energy estimates

perf can access the Intel RAPL energy estimates. The following example shows how to invoke it for this purpose.

sudo perf stat -a -r 1 \
    -e "power/energy-pkg/" \
    -e "power/energy-cores/" \
    -e "power/energy-gpu/" \
    -e "power/energy-ram/" \
    <command>

The -a is necessary; it means "all cores", and without it all the measurements will be zero. The -r 1 means <command> is executed once; higher values can be used to get variations.

The output will look like the following.

Performance counter stats for 'system wide':

   51.58 Joules power/energy-pkg/     [100.00%]
   14.80 Joules power/energy-cores/   [100.00%]
    9.93 Joules power/energy-gpu/     [100.00%]
   27.38 Joules power/energy-ram/     [100.00%]

5.003049064 seconds time elapsed

It's not clear from the output, but the following relationship holds.

energy-pkg >= energy-cores + energy-gpu

The measurement is in Joules, which is usually less useful than Watts.

For these reasons rapl is usually a better tool for measuring power consumption on Linux.

Wakeups

perf can also be used to do high-context profiling of wakeups.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:43 次

字数:2239

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文