对读取输入文件的应用程序使用 perf 命令
Using perf command for an application which reads input file
一些应用程序通过 <
字符读取输入文件。例如,
./run_rog < input.txt
然而,以这种方式传递输入文件对 perf
命令无效。
perf stat -e instructions ./run_prog < input.txt
Failed opening logfd: Invalid argument
我该如何解决?
据此source
When running perf-stat in certain shell environments with stdout
redirection there is a logging file descriptor setup failure:
Failed opening logfd: Invalid argument
显然,perf 工具需要应用补丁来解决此问题。
PS:尝试重现您的问题:
$ > perf --version
perf version 2.6.32-431.11.2.el6.x86_64.debug
没有问题:
$ > echo 'Test my perf' > input.txt
$ > perf stat -e instructions cat < input.txt
Test my perf
Performance counter stats for 'cat':
580,283 instructions # 0.00 insns per cycle
0.003284129 seconds time elapsed
这里有希望:这对我来说适用于性能为 3.16.4 的 openSUSE 13.2。两条命令
echo 'This is the input file' > input.txt
perf stat -e instructions /usr/bin/cat < input.txt
产生输出
This is the input file
Performance counter stats for '/usr/bin/cat':
1,181,541 instructions
0.000597226 seconds time elapsed
一些应用程序通过 <
字符读取输入文件。例如,
./run_rog < input.txt
然而,以这种方式传递输入文件对 perf
命令无效。
perf stat -e instructions ./run_prog < input.txt
Failed opening logfd: Invalid argument
我该如何解决?
据此source
When running perf-stat in certain shell environments with stdout redirection there is a logging file descriptor setup failure:
Failed opening logfd: Invalid argument
显然,perf 工具需要应用补丁来解决此问题。
PS:尝试重现您的问题:
$ > perf --version
perf version 2.6.32-431.11.2.el6.x86_64.debug
没有问题:
$ > echo 'Test my perf' > input.txt
$ > perf stat -e instructions cat < input.txt
Test my perf
Performance counter stats for 'cat':
580,283 instructions # 0.00 insns per cycle
0.003284129 seconds time elapsed
这里有希望:这对我来说适用于性能为 3.16.4 的 openSUSE 13.2。两条命令
echo 'This is the input file' > input.txt
perf stat -e instructions /usr/bin/cat < input.txt
产生输出
This is the input file
Performance counter stats for '/usr/bin/cat':
1,181,541 instructions
0.000597226 seconds time elapsed