summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2012-05-15 11:11:11 (GMT)
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-06-11 14:20:21 (GMT)
commitfc3e4d077d5c7a7bc1ad5bc143895b4e070e5a8b (patch)
tree47c8345fbc1615a4118183d0eb1355ab2399651c /include
parent80c0120a3cca30166c0ab8b24e44be67e97b79af (diff)
downloadlinux-fc3e4d077d5c7a7bc1ad5bc143895b4e070e5a8b.tar.xz
perf stat: Fix default output file
The following commit: commit 56f3bae70638b33477a6015fd362ccfe354fd3ee Author: Jim Cromie <jim.cromie@gmail.com> Date: Wed Sep 7 17:14:00 2011 -0600 perf stat: Add --log-fd <N> option to redirect stderr elsewhere introduced a bug in the way perf stat outputs the results by default, i.e., without the --log-fd or --output option. It would default to writing to file descriptor 0, i.e., stdin. Writing to stdin is allowed and is equivalent to writing to stdout. However, there is a major difference for any script that was already capturing the output of perf stat via redirection: perf stat >/tmp/log .... or perf stat 2>/tmp/log .... They would not capture anything anymore. They would have to do: perf stat 0>/tmp/log ... This breaks compatibility with existing scripts and does not look very natural. This patch fixes the problem by looking at output_fd only when it was modified by user (> 0). It also checks that the value if positive. Passing --log-fd 0 is ignored. I would also argue that defaulting to stderr for the results is not the right thing to do, though this patch does not address this specific issue. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Jim Cromie <jim.cromie@gmail.com> Link: http://lkml.kernel.org/r/20120515111111.GA9870@quad Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions