[英]how to save ouput of perf (Linux tool) to a file?
我想在運行 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.