--- title: description: date: 2023-04-16 lang: zh-tw tags: - 樹莓派 - Linux - --- # 樹梅派筆記-超頻 在入手樹梅派時有順手買的簡單的鋁質散熱殼,還附有兩個小風扇 一直以來都是用默認設定在跑 但總是覺得有點卡卡的 因此想說來超頻看看 看能壓榨多少性能出來 ## 前置需求 確保系統與套件都是最新版本 ```zsh= sudo apt update && sudo apt upgrade -y sudo apt dist-upgrade -y ``` ## 開始超頻 只要簡單修改`config`文件就能超頻了 ```zsh= sudo nano /boot/config.txt ``` 找到 ```txt= #uncomment to overclock the arm. 700 MHz is the default. ``` 並加入 ```txt= over_voltage=6 arm_freq=2000 # gpu_freq=750 #force_turbo=1 ``` * `over_voltage` - 提高核心電壓 * `arm_freq` - 設定最高CPU核心頻率 * `gpu_freq` - 設定最高GPU核心頻率 * `force_turbo` - 強制運行最高頻率(即使負載不高也是) > `force_turbo=1` 時 `over_voltage`才能大於6 重啟,套用配置 ```zsh= sudo reboot ``` ## 結果 可以使用`sysbench`跑CPU壓力測試,用來確認結 安裝`sysbench` ```zsh= sudo apt install sysbench -y ``` 監控CPU核心頻率 ```zsh= watch -n1 vcgencmd measure_clock arm ``` 監控溫度 ```zsh= watch -n1 vcgencmd measure_temp ``` 開始壓力測試 ```zsh= sysbench --num-threads=8 --test=cpu --cpu-max-prime=20000 run ``` 結果 ```zsh= sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 8 Initializing random number generator from current time Prime numbers limit: 20000 Initializing worker threads... Threads started! CPU speed: events per second: 935.17 General statistics: total time: 10.0071s total number of events: 9366 Latency (ms): min: 1.27 avg: 8.54 max: 57.53 95th percentile: 20.37 sum: 79945.24 Threads fairness: events (avg/stddev): 1170.7500/91.74 execution time (avg/stddev): 9.9932/0.01 ``` CPU核心頻率 ```zsh= Every 1.0s: vcgencmd measure_clock arm frequency(48)=2000478464 ``` 溫度 ```zsh= Every 1.0s: vcgencmd measure_temp temp=47.7'C ``` 的確有到設定的最高CPU核心頻率且溫度也才不到50度 順帶一提,未超頻跑sysbench 測試,需要15秒完成 超完頻只需要10秒,進步巨大 ## 總結 從日常使用中,的確有感覺超頻後,跑程式快了很多 只靠被動散熱,未開啟風扇時,溫度也不高 雖然開了風扇可以更低,約40度 但實在太吵了,有股嗡嗡聲 這樣就足夠了 ## Ref: * https://beebom.com/how-overclock-raspberry-pi-4/ * https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking-options