Some applications read input file via <
character. For example,
./run_rog < input.txt
However passing the input file in such a way is invalid for perf
command.
perf stat -e instructions ./run_prog < input.txt
Failed opening logfd: Invalid argument
How can I fix that?
According to this 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
Apparently, the perf tool needs applying a patch for solving this issue.
PS: Tried reproducing your problem with:
$ > perf --version
perf version 2.6.32-431.11.2.el6.x86_64.debug
Got no issue:
$ > 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