固定效能模式
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
發布版本:Android 11 (API 級別 30)
Android 裝置可以根據系統負載動態變更時鐘。這個
使用行為可以節省電力,但也可能導致
可靠的成效資料如果嘗試判斷程式碼
片段可以執行,避免迴歸問題、如果可重複執行最佳化,
如果未以固定時脈速度進行測試,將可能無法獲得可靠的結果。取代為
固定時鐘一樣能準確執行成效的 A/B 測試,
CPU 頻率是因素之一
固定效能模式會設定 CPU 和 GPU 時脈的上限和下限。
這個模式不會停用其他動態效能行為,例如核心肌群。
。
您可以使用下列 ADB 指令啟用固定效能模式:
adb shell cmd power set-fixed-performance-mode-enabled [true|false]
在固定效能模式下執行的裝置仍可能過熱,因為
這個模式不會將裝置進入熱力永續狀態因為
因此,建議您執行以下基準測試:
- 等待裝置返回熱力永續狀態再啟動
- 在測試期間監控裝置的熱力狀態,區分
基準程式碼與熱力事件間的影響
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[],[],null,["# Fixed Performance Mode\n\n**Released**: Android 11 (API level 30)\n\nAndroid devices can change clocking dynamically based on the system load. This\nbehavior is good for power savings during use, but can make it difficult to get\nreliable performance data. If you are trying to determine how fast a code\nfragment can run for regression prevention, or if an optimization is repeatable,\nyour results won't be reliable if they aren't tested at fixed clock speeds. With\nfixed clocks, you can do accurate A/B testing of performance without changes in\nthe CPU frequency being a factor.\n\nFixed-performance mode sets CPU and GPU clocks with an upper and lower bound.\nThis mode does not disable other dynamic performance behaviors, such as core\nselection.\n\nYou can enable fixed-performance mode with the following adb command: \n\n adb shell cmd power set-fixed-performance-mode-enabled [true|false]\n\nA device that is running in fixed-performance mode can still overheat because\nthe mode doesn't put the device into a thermally-sustainable state. Because of\nthis, we recommend the following for benchmark runs:\n\n- Wait for the device to return to a thermally-sustainable state before starting the run.\n- Monitor the thermal state of the device during testing to differentiate the impact between the benchmark code and thermal events."]]