簡體   English   中英

如何將 perf(Linux 工具)的輸出保存到文件中?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM