问题标签 [perf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
6355 浏览

linux - 性能输出无法重定向到文件

我正在 Ubuntu(12.0.4 LTS)上使用 perf(Linux 工具),我目前正试图将工具的输出重定向到文件。这个问题已在许多帖子中得到解决,但任何提议的解决方案都对我不起作用。

我在这里尝试的是:跟踪 pid 的统计信息并将它们存储在文件中。在一个终端上运行 perf 工具,在另一个终端上使用 kill -INT 命令 ( sudo kill -INT $pid) 终止 perf 进程。受到网络上不同解决方案的启发(例如,如何将 perf(Linux 工具)的输出保存到文件中?)我尝试了不同的命令组合,例如:

  1. perf stat -o hhe.txt -e minor-faults,major-faults,cs -p 14615
  2. perf stat --output hhe.txt -e minor-faults,major-faults,cs -p 14615
  3. perf stat --output hhe.txt --append -e minor-faults,major-faults,cs -p 14615
  4. perf stat -e minor-faults,major-faults,cs -p 14615 2> hhe.txt
  5. perf stat -e minor-faults,major-faults,cs -p 14615 0> hhe.txt
  6. perf stat -e minor-faults,major-faults,cs -p 14615 >> hhe.txt

对于在 sudo 模式下运行的所有这些命令,输出不会写入文件。我不确定为什么。也许是因为 kill 命令;但以下链接说它有效:http ://comments.gmane.org/gmane.linux.kernel.perf.user/911

我不确定我做错了什么。任何帮助,将不胜感激。

0 投票
1 回答
70 浏览

profiling - Perf 报告的 IP 值不完整

我尝试使用 perf 分析我的程序 myprog,这就是我得到的:

objdump -D用来查看 IP 指的是哪条指令。问题是,这里显示的 0x743a IP 在 myprog 的 .debug 部分中。

perf 提供的十六进制值可以匹配转储中的多个位置,如下所示:

正确的 IP 是 0x40743a,如下所示:

有人知道发生了什么吗?

0 投票
3 回答
5061 浏览

android - 为 android 编译 linux 工具 perf

我想为 android 设备编译 pref,我是根据指南指南完成的。一个我设置NDK环境使用Android NDK r9

我用工具运行 make

我收到错误消息,您能帮帮我吗?

Android NDK:NDK_TOOLCHAIN 定义为不受支持的值 android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
Android NDK:请使用以下值之一:arm-linux-androideabi-4.6 arm-linux-androideabi-4.8 arm-linux-androideabi-clang3.2 arm-linux-androideabi-clang3.3 mipsel-linux-android-4.6 mipsel-linux-android-4.8 mipsel-linux -android-clang3.2 mipsel-linux-android-clang3.3 x86-4.6 x86-4.8 x86-clang3.2 x86-clang3.3
build/core/init.mk:555: * Android NDK: Aborting . 停止。

0 投票
2 回答
5015 浏览

android - 如何安装 glibc 为 android 编译 perf

当我为 android 编译 perf 时,我收到错误:

*没有找到 gnu/libc-version.h,请安装 glibc-dev[el]/glibc-static

我尝试安装 libc6-dev 和 build-essential 但我仍然遇到此错误。之后,我按照说明编译并安装 glibc:

http://www.tldp.org/HOWTO/Glibc2-HOWTO-5.html

http://ftp.gnu.org/gnu/libc/

但是,这种方式我有一些问题,所以 glibc 安装成功。您有什么想法可以解决该错误或安装 glibc-dev 作为建议吗?谢谢

0 投票
1 回答
7748 浏览

c - Getting user-space stack information from perf

I'm currently trying to track down some phantom I/O in a PostgreSQL build I'm testing. It's a multi-process server and it isn't simple to associate disk I/O back to a particular back-end and query.

I thought Linux's perf tool would be ideal for this, but I'm struggling to capture block I/O performance counter metrics and associate them with user-space activity.

It's easy to record block I/O requests and completions with, eg:

and the user-space pid is recorded, but there's no kernel or user-space stack captured, or ability to snapshot bits of the user-space process's heap (say, query text) etc. So while you have the pid, you don't know what the process was doing at that point. Just perf script output like:

If I add the -g flag to perf record it'll take snapshots of the kernel stack, but doesn't capture user-space state for perf events captured in the kernel. The user-space stack only goes up to the entry-point from userspace, like LWLockRelease, LWLockAcquire, memcpy (mmap'd IO), __GI___libc_write, etc.

So. Any tips? Being able to capture a snapshot of the user-space stack in response to kernel events would be ideal.

I'm on Fedora 19, 3.11.3-201.fc19.x86_64, Schrödinger’s Cat, with perf version 3.10.9-200.fc19.x86_64.

0 投票
2 回答
1119 浏览

c - 在“perf”事件中捕获用户空间变量

现在已经能够perf捕获用户空间堆栈,但我不确定如何说服它捕获通过引用传递的值作为指针,或捕获感兴趣的全局快照。

具体来说,我正在尝试分析 PostgreSQL 在各种负载下的系统范围性能,无论是否有性能相关的补丁。我需要做的关键事情之一是告诉内核中哪些查询哪些块 I/O 请求相关联。

perf记录 pid 和用户空间堆栈,其中有时包含current_query,但由于它是一个字符串,它是通过引用传递的,所以我得到的只是一个不透明的指针。不是很有用。它也不会出现在所有跟踪中,所以理想情况下,我会从全局 PostgreSQL 中提取值并将其存储在perf每个跟踪样本中并记录下来。事后将 pid 与查询匹配可能是可行的,但给定的 PostgreSQL 后端 (pid) 在其生命周期内不会只运行一个查询,因此perf需要在跟踪和 PostgreSQL 日志之间使用大量相关的时间戳。

这似乎是您期望它能够做的事情,因为通常单独的堆栈并不能告诉您正在发生的事情,如果它已经可以读取符号表,它应该能够查看up globals 并知道哪些函数参数是需要取消引用的指针并复制前“n”个字节。

不过,我一生都无法弄清楚如何做到这一点,或者这是否可能。我只是运气不好?我需要破解perf injectPostgreSQL 记录的单独时间戳日志中的这些信息吗?

0 投票
4 回答
5354 浏览

linux - 了解 Perf 工具输出

我最近在我的平台上安装了 Perf 工具,并想用它来分析我的平台。我开始分析一个独立的应用程序。下面我使用的命令

perf start ./helloworld

'./helloworld' 的性能计数器统计信息:

现在我不确定我应该如何解释这个输出。它是预期的输出吗?

另外,我应该如何处理此处提交的<不支持>,在运行命令之前我需要启用什么来支持此文件吗?

0 投票
1 回答
3359 浏览

ubuntu - ubuntu 12.10 性能统计循环

我使用的系统是 ubuntu-12.10-desktop-amd64

我通过安装 perf

当我使用 时perf list,它会按预期列出所有事件。但是当我使用时perf stat,结果似乎异常

结果是:

为什么不支持这些事件?启用这些事件需要任何操作吗?

0 投票
1 回答
1869 浏览

linux - 我在linux上用perf读取了计数器的值,它的值总是0

我在 Ubuntu 12.04 上运行该程序,计数器的值为 awalys 0。看来我的计数器对我不起作用。

当我运行程序时,输出是:



我无法理解这些值的含义。我想要得到的是每个 cpu 的缓存引用,它是缓存未命中。但显然结果似乎不正确!

我已经阅读了有关 perf 方法的文档:http: //www.man7.org/linux/man-pages/man2/perf_event_open.2.html

我还运行http://www.man7.org/linux/man-pages/man2/perf_event_open.2.html给出的示例

但是,不幸的是,结果也总是 0。这是手册页中的示例。

下面是一个简短的示例,用于测量调用 printf(3) 的总指令数。

0 投票
1 回答
218 浏览

linux - 主要性能和 PIN 分析差异

为了分析执行时间的某些属性,我打算在程序的单独执行中同时使用PerfPIN来获取我的所有信息。PIN 会给我指令混音,Perf 会给我这些混音的硬件性能。作为健全性检查,我分析了以下命令行参数:

所以我完整的命令行输入如下:

在 PIN 命令中,为了这篇文章,我忽略了文件的所有路径内容。icount.so此外,除了默认的动态指令计数之外,我还更改了基本指令以记录指令混合。结果惊人地不同

这应该通过具有大致相同的指令数和大致相同的分支分布来作为完整性检查。 为什么动态指令计数会减少x100倍?! 我期待一些噪音,但这有点多。

此外,Perf 的分支数量为 20%,但 PIN 报告约为 25%(这似乎也有一点差异,但这可能只是大量指令计数失真的副作用)。