天天看點

ubuntu cargo flamegraph

cargo flamegraph      

有如下選項:

運作指定binnary

-b your-binnary      

指定采樣頻率

-F xxx      

機關好像是Hz

傳參

-- your-arg your-value      

傳入perf參數

-c "要給perf的參數      

比如

cargo flamegraph -c "record -e branch-misses -c 100 --call-graph lbr -g"      

例子

cargo flamegraph -F 1      
cargo flamegraph -c "recor
d -a -F 1 --call-graph=dwarf" --bin transaction-replayer -- --start-epoch 18000000 --epoch-to-execute 1000000 --commit-interval 10000      

注意用了​

​-c​

​​時,​

​-F 1​

​​要放到​

​-c​

​後面的perf參數裡。

常見錯誤的處理

could not spawn perf      
sudo apt install      
WARNING: perf not found for kernel 4.15.0-144

  You may need to install the following packages for this specific kernel:
    linux-tools-4.15.0-144-generic
    linux-cloud-tools-4.15.0-144-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic
failed to sample program      
sudo apt install      

參考文獻

繼續閱讀