Step 1: Test out the base sample app
The base sample is written with classic simple approach:
Check CPU / GPU bottleneck
Trigger when thermal status is changed
Adjust CPU / GPU clock level
Adjust quality setting by setting LOD
Adjust target FPS
All of these can be controlled in real-time.
Step 2: Install Adpative Performance package
Go to Editor -> Windows -> Package Manager -> Install ‘Adaptive Performance’ Package.
Step 3: Modify C# script
Go to Editor -> Window -> Package Manager -> Import ‘Adaptive Performance’ Package.
AdaptivePerformanceController.cs script file to edit.
Modify script as intended.
Step 4: Build and launch APK
Select File > Build Settings.
Check that the device is connected and check the Development Build / Scripts Only Build option.
Then, click Patch and the installed APK on your device will be updated.
Step 5: Measure performance
To check current application performance, check the FPS and CPU / GPU load counters.
As you can see, performance is not very good. Our next step is to check current status where we will try to:
Check performance status to know if there is any bottleneck
CPU: Frame rate is limited by CPU processing
GPU: Frame rate is limited by GPU processing
TargetFrameRate: Can’t reach target frame rate
- Frame rate is limited by
Application.targetFrameRate. In this case, the application should consider lowering performance requirements.
- Frame rate is limited by
Step 6: Check thermal status
Register event handler to trigger thermal status and set handler into:
ThermalMetrics information in event handler:
TemperatureLevel (0.0 ~ 1.0)
Current normalized temperature level in the range of [0, 1]. A value of 0 means standard operation temperature and the device is not in a throttling state. A value of 1 means that the maximum temperature of the device is reached and the device is going into or is already in throttling state.
TemperatureTrend (-1.0 ~ 1.0)
Current normalized temperature trend in the range of [-1, 1]. A value of 1 describes a rapid increase in temperature. A value of 0 describes a constant temperature. A value of -1 describes a rapid decrease in temperature. Please note that it takes at least 10s until the temperature trend may reflect any changes.
Step 7: Adjust target frame rate
Change target frame rate when thermal status is changed. For example:
Step 8: Change the quality setting
Change the quality setting by adjusting LOD in real-time. For example:
Step 9: Adjust CPU/GPU clock
Change CPU / GPU clock level by
When set to true (default)
GpuLevelare set automatically by Adaptive Performance.
The maximum valid CPU performance level you use with
CpuLevel. The minimum value returned is
MinCpuPerformanceLevel. This value does not change after startup is complete.
The maximum valid GPU performance level you use with
GpuLevel. The minimum value returned is
MinGpuPerformanceLevel. This value does not change after startup is complete.
The requested CPU performance level. Higher levels typically allow CPU cores to run at higher clock speeds. The consequence is that thermal warnings and throttling may happen sooner when the device cannot sustain high clock speeds. Changes are applied once per frame. We recommended to set the
CpuLevelas low as possible to save power. The valid value range is [
The requested GPU performance level. Higher levels typically allow the GPU to run at higher clock speeds. The consequence is that thermal warnings and throttling may happen sooner when the device cannot sustain high clock speeds. Changes are applied once per frame. We recommended to set the
GpuLevelas low as possible to save power. The valid value range is [
Check the current status by:
ThermalMetrics.WarningLevel(NoWarning/ ThrottlingImminent/ Throtting)
PerformanceBottleneck(CPU / GPU / TargetFrameRate)
Control the performance by adjusting:
CPU / GPU clock level
Target frame rate
If possible, GFX load (triangles, memory, draw calls..)
Frame Rate now displays a stable FPS with Adaptive Performance.
Congratulations! You have successfully achieved the goal of this Code Lab activity. Now, you can improve the frame rate using Adaptive Performance by yourself! But, if you're having trouble, you may check out the link below.