The static API is a simple function call to control CPU and GPU clock frequency: request_mode(mode, duration, device). For each argument, developers can:
- Choose from five pre-defined modes made available as part of the SDK
- Specify time duration for which the mode should be active
- Target the device (big CPU, LITTLE CPU, GPU)
The modes are as follows:
In efficient mode, all cores are usually running close to 50 percent of maximum clock frequency. For computationally expensive algorithms, developers can use performance burst mode to spike all available cores in the system to their maximum frequency for a very short duration. This is designed to yield the best possible performance for the application. Saver mode uses half of peak performance; developers can use this mode when they know that the application does not require all CPU cores. Window mode allows the developer to define a frequency range; this mode usually yields the optimal power-performance trade-off.
The following code extends the sample used in the tutorial for the Qualcomm® Snapdragon™ Heterogeneous Compute SDK.
Before invoking hetcompute to create and launch the vector_double operation as a task using the Snapdragon Heterogeneous Compute runtime, the highlighted code calls the static API request_mode. It requests that big CPU run between 50 and 60 percent of the maximum CPU frequency.
If Perflock honors that request, then the vector_double API will execute much more power-efficiently.
Qualcomm Snapdragon is a product of Qualcomm Technologies, Inc. and/or its subsidiaries.