我想运行perf命令后保存结果,例如。
perf stat -B dd if = / dev / zero of = / dev / null count = 1000000> result1
我尝试了几个方法,比如
(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
好吧,这些都没有给我什么我想要的。
结果是
性能计数器统计'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"
我只是想将这些保存到文件中。
非常感谢!!!
strace
显示perf
写入文件描述符0,所以这应该工作:
perf stat -B dd if=/dev/zero of=/dev/null count=1000000 0> result1