照作業步驟跑一次併紀錄問題
comment
輸入perf top -p $pid後,小黑窗說-需要值,請問要如何輸入。HankLo
在分析運算效能時,要開兩個小黑窗,一個執行程式,另一個分析效能。在計算圓周率main c 可以看到getpid(),會得到一個值,這應該是個條碼,在另一個黑窗測試效能時要輸入這個條碼,它就會開始分析此程式。HankLo
參考jkrvivian使用sudo perf top -p $! 有一樣的效果,因為 $! 是最後一個輸出,所以會自動抓取example的pid $表示讀取命令行參數。 HankLo
comment
perf stat --repeat 100 \-e cache-misses,cache-references,instructions,cycles \
$make run
把lastName[]獨立出來。
結果size of entry : 24 bytes,且append time 及 findName time下降。
比較cache-misses
原始
$perf stat --repeat 5 -e cache-misses,cache-references,instructions,cycles ./phonebook_orig
修正後
$perf stat --repeat 5 -e cache-misses,cache-references,instructions,cycles ./phonebook_opt
結果cache-misses從3,435,530降為1,219,623,
cpu time從0.060823295降為0.047547781。
單位是?HankLo
不大了解hash function作用,閱讀hashing。
透過hasu function將原始資料結構改變、壓縮。