如何将perf.data范围缩小到一个时间子间隔 [英] How to narrow down perf.data to a time sub interval

查看:156
本文介绍了如何将perf.data范围缩小到一个时间子间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用linux perf(perf_events)生成带有时间戳的perf.data文件.

I use linux perf (perf_events) to produce a perf.data file with timestamps.

如何在[i-start,i-end]子时间间隔内生成所有事件的报告?

How can I generate a report of all the events in a sub interval of time [i-start, i-end]?

我可以将perf.data的范围缩小到只包含[i-start,i-end]中事件的perf_subinterv.data文件吗?

Can I maybe narrow down perf.data to a perf_subinterv.data file with only events in [i-start, i-end]?

我需要执行此操作,以便每5分钟左右分析一次性能不佳的短间隔(2s-6s).

I need to do this to analyze short intervals (2s - 6s) of poor performance every 5mins or so.

推荐答案

大多数perf工具(包括perf report)支持按时间过滤:

Most perf tools, including perf report, support filtering by time:

--time::
  Only analyze samples within given time window: <start>,<stop>. Times
  have the format seconds.microseconds. If start is not given (i.e., time
  string is ',x.y') then analysis starts at the beginning of the file. If
  stop time is not given (i.e, time string is 'x.y,') then analysis goes
  to end of file.

有关更多详细信息,请参见 man perf-report .

For more details see man perf-report.

此版本自4.10版本(2017年2月)开始存在.如果运行较旧的内核,则可以尝试自己构建perf的用户空间工具部分.在较新的版本中,可以指定时间百分比和多个时间范围.

This is present since version 4.10 (Feb 2017). If you run an older kernel you can try to build the userspace tools part of perf yourself. In more recent versions it is possible to specify time percent and multiple time ranges.

这篇关于如何将perf.data范围缩小到一个时间子间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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