2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
パフォーマンスの管理
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android デバイスの消費電力とパフォーマンスを管理することにより、さまざまなハードウェアでアプリが安定してスムーズに動作することを保証できます。Android 7.0 以降では、OEM はパフォーマンス維持のヒントのサポートを実装できます。これにより、アプリの実行中に安定したデバイス パフォーマンスを維持することや、CPU を集中的に使用するフォアグラウンド アプリのパフォーマンスを改善するために専用コアを指定することが可能になりました。
アプリ(ゲーム、カメラ、RenderScript、オーディオ処理など)を長時間実行していると、デバイスの温度制限に達してシステム オン チップ(SoC)エンジンがスロットリングされ、パフォーマンスが大きく変動することがあります。長時間実行される高パフォーマンスのアプリを作成するアプリ デベロッパーは、デバイスが過熱し始めると基盤プラットフォームのパフォーマンスが変動して目標値を定められないという制約を受けます。
こうした制約に対処するため、Android 7.0 ではパフォーマンス維持のサポートが導入され、OEM は長時間実行されるアプリ向けにデバイスのパフォーマンス能力に関するヒントを提供できるようになりました。アプリ デベロッパーは、こうしたヒントを利用して、デバイスが長期間にわたり予測可能な一定のパフォーマンス レベルを維持できるようにアプリを調整できます。
アーキテクチャ
Android アプリは、Android デバイスが一定レベルのパフォーマンスを長時間にわたって維持できるパフォーマンス維持モードに入るようプラットフォームに要求できます。

図 1. パフォーマンス維持モードのアーキテクチャ
実装
Android 7.0 以降でパフォーマンス維持をサポートするには、OEM は次のことを行う必要があります。
- 電力 HAL にデバイス固有の変更を加えて、最大 CPU / GPU 周波数をロックする。または、サーマル スロットリングを防ぐために他の最適化を行う。
- 電力 HAL に新しいヒント
POWER_HINT_SUSTAINED_PERFORMANCE
を実装する。
isSustainedPerformanceModeSupported()
API で TRUE を返すことにより、サポートを宣言する。
Window.setSustainedPerformanceMode
を実装する。
Nexus のリファレンス実装では、電力ヒントによって、最高の維持レベルで CPU と GPU の最大周波数が制限されます。CPU / GPU 周波数の最大値を示すバーを下げるとフレームレートが低下しますが、このモードでは持続性に優れた低いフレームレートが優先されます。たとえば、通常の最大クロック数で動作するデバイスでは、60 FPS でのレンダリングを数分間実行できますが、30 分経過してデバイスが加熱すると 30 FPS にスロットリングされることがあります。維持モードを使用すると、このデバイスは 30 分の間、常に 45 FPS でレンダリングできます。目標は、このモードを使用しない場合のフレームレートと同等(またはそれ以上)のフレームレートを実現することと、デベロッパーがフレームレートの変動を追いかけなくてすむように長時間にわたってフレームレートを安定させることです。
デバイスが最大限のパフォーマンス維持を実現できる維持モードを実装することを強くおすすめします。テストに合格するための最小要件(たとえば、長時間にわたるサーマル スロットリングを発生させないための最大周波数制限の選択など)では不十分です。
注: 維持モードを実装する場合、最大クロックレートの上限を設ける必要はありません。
検証
OEM は、CTS テスト(Android 7.0 以降)を使用して、パフォーマンス維持 API の実装を検証できます。このテストは、約 30 分間ワークロードを実行し、維持モードを有効にした場合と無効にした場合のパフォーマンスをベンチマーク評価します。
- 維持モードを有効にした場合のフレームレートがほぼ一定に保たれることが必要です(テストでは、フレームレートの経時的な変動率を測定し、5% 未満であれば合格とします)。
- 維持モードを有効にした場合のフレームレートが、維持モードを無効にした場合の 30 分経過後のフレームレートを下回らないことが必要です。
さらに、CPU と GPU を集中的に使用するワークロードをいくつか実行して、手動で実装をテストします。これにより、30 分経過後にデバイスでサーマル スロットリングが発生しないことを確認します。Google の内部テストでは、ゲームアプリとベンチマーク アプリ(gfxbench など)を含むサンプル ワークロードを使用しました。
専用コア
CPU を集中的に使用する緊急のワークロードの場合、別のスレッドによってプリエンプトされると、フレーム期限を守れるかどうかという問題が生じます。遅延とフレームレートの要件が厳格なアプリ(オーディオ アプリやバーチャル リアリティ アプリなど)では、専用の CPU コアを用意することで、許容可能なレベルのパフォーマンスを確保できます。
Android 7.0 以降を搭載したデバイスでは、トップ フォアグラウンド アプリ用に 1 つのコアを明示的に予約できます。これにより、高負荷のワークロードを実行するアプリは CPU コア間の作業割り当てをよりきめ細かく制御できるようになりました。
デバイスで専用コアをサポートするには:
cpusets
を有効にし、トップ フォアグラウンド アプリのみを含む cpuset
を構成します。
- この
cpuset
からのスレッド用に 1 つのコア(これが専用コアです)を予約します。
- 専用コアのコア番号を返す getExclusiveCores API を実装します。
どのプロセスがどのコアでスケジュール設定されているかを特定するには、ワークロードの実行時に systrace
を使用し、トップ フォアグラウンド アプリ以外のアプリからのユーザー空間スレッドが専用コアでスケジュール設定されていないことを確認します。
Nexus 6P 向けのリファレンス実装を確認するには、android//device/huawei/angler/power/power.c
をご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Performance management\n\nManaging the power and performance of Android devices can help ensure\napps run consistently and smoothly on a wide range of hardware. In\nAndroid 7.0 and later, OEMs can implement support for sustained performance hints that\nenable apps to maintain a consistent device performance and specify an exclusive\ncore to improve performance for CPU-intensive, foreground apps.\n\nSustained performance\n---------------------\n\nFor long-running apps (games, camera,\n[RenderScript](/docs/core/architecture/vndk/renderscript), audio\nprocessing), performance can vary dramatically as device temperature limits are\nreached and system on chip (SoC) engines are throttled. App developers creating\nhigh-performance, long-running apps are limited because the capabilities of the\nunderlying platform are a moving target when the device begins to heat up.\n\nTo address these limitations, Android 7.0 introduced support for sustained\nperformance, enabling OEMs to provide hints on device performance capabilities\nfor long-running apps. App developers can use these hints to tune\napps for a predictable, consistent level of device performance over long\nperiods of time.\n\n### Architecture\n\nAn Android app can request the platform to enter a sustained\nperformance mode where the Android device can keep a consistent level of\nperformance for prolonged periods of time.\n\n**Figure 1.** Sustained performance mode\narchitecture.\n\n### Implementation\n\nTo support sustained performance in Android 7.0 and later, OEMs must:\n\n- Make device-specific changes to the power HAL to either lock the maximum CPU/GPU frequencies **or** perform other optimizations to prevent thermal throttling.\n- Implement the new hint `POWER_HINT_SUSTAINED_PERFORMANCE` in power HAL.\n- Declare support by returning TRUE through the `isSustainedPerformanceModeSupported()` API.\n- Implement `Window.setSustainedPerformanceMode`.\n\nIn the Nexus reference implementation, the power hint caps the\nmaximum frequencies of the CPU and GPU at the highest sustainable levels. Keep\nin mind that lowering the MAX bar in CPU/GPU frequency will lower the frame\nrate, but this lower rate is preferred in this mode due to its sustainability.\nFor example, a device using normal max clocks might be able to render at 60\nFPS for a few minutes, but after the device heats up, it may throttle to 30 FPS\nby the end of 30 minutes. When using sustained mode, the device can, for\nexample, render consistently at 45 FPS for the entire 30 minutes. The goal is a\nframe rate when using the mode that is as high (or higher) than the frame rate\nwhen not using the mode, and consistent over time so that developers don't have\nto chase a moving target.\n\nWe strongly recommend implementing sustained mode such that the device\nachieves the highest possible sustained performance---not just the minimum values\nrequired to pass the test (e.g. choose the highest possible MAX frequency caps\nthat don't cause the device to thermally throttle over time).\n\n**Note**: Capping MAX clock rates isn't required\nto implement sustained mode.\n\n### Validation\n\nOEMs can use a CTS test (Android 7.0 and later) to verify their implementation of the\nsustained performance API. The test runs a workload for approximately 30 minutes\nand benchmarks the performance with and without sustained mode enabled:\n\n- With sustained mode enabled, the frame rate must remain relatively constant (test measures the percentage of change in frame rate over time and requires a \\\u003c5% change).\n- With sustained mode enabled, the frame rate must not be lower than the frame rate at the end of 30 minutes with the mode disabled.\n\nIn addition, you can manually test your implementation with several CPU- and\nGPU-intensive workloads to ensure the device doesn't thermally throttle after\n30 minutes of use. In internal testing, we used sample workloads including\ngames and benchmarking apps (e.g.\n[gfxbench](https://gfxbench.com/result.jsp)).\n\nExclusive cores\n---------------\n\nFor CPU-intensive, time-sensitive workloads, getting preempted by another\nthread can be the difference between making frame deadlines or not. For apps\nthat have strict latency and frame rate requirements (such as audio or virtual\nreality apps), having an exclusive CPU core can guarantee an acceptable level of\nperformance.\n\nDevices running Android 7.0 or later can now reserve one core explicitly for the top\nforeground app, improving performance for all foreground apps and giving\napps with high intensity workloads more control over how their work is allocated\nacross CPU cores.\n\nTo support an exclusive core on a device:\n\n- Enable `cpusets` and configure a `cpuset` that contains only the top foreground app.\n- Ensure one core (this is the exclusive core) is reserved for threads from this `cpuset`.\n- Implement the getExclusiveCores API to return the core number of the exclusive core.\n\nTo determine which processes are scheduled on which cores, use\n`systrace` while running any workload and verify no userspace threads\nfrom apps other than the top foreground app are scheduled on the\nexclusive core.\n\nTo view a reference implementation for the Nexus 6P, refer to\n`android//device/huawei/angler/power/power.c`."]]