Issue
I want to save results after running perf command, eg.
perf stat -B dd if=/dev/zero of=/dev/null count=1000000 &> result1
I tried a couple of ways, like
(perf stat -B dd if=/dev/zero of=/dev/null count=1000000 &>result1) > result2
(perf stat -B dd if=/dev/zero of=/dev/null count=1000000 &>result1) 2> result2
(perf stat -B dd if=/dev/zero of=/dev/null count=1000000 &>result1) &> result2
((perf stat -B dd if=/dev/zero of=/dev/null count=1000000 &>result1) &> result2) > result3
well, none of these actually gave me what I want.
The result is
Performance counter stats for 'dd if=enter code here
/dev/zero of=/dev/null count=1000000':
235.959041 task-clock # 0.998 CPUs utilized
20 context-switches # 0.000 M/sec
.........(too long, dont want to have all of them here)
0.236448007 seconds time elapsed"
I just want to save these to the file.
Solution
strace
shows that perf
writes to file descriptor 0, so this should work:
perf stat -B dd if=/dev/zero of=/dev/null count=1000000 0> result1
Answered By - Ansgar Wiechers Answer Checked By - Katrina (WPSolving Volunteer)