The dynamic APIs allow the Power Optimization SDK runtime to regulate performance on its own, while trying to minimize power consumption. The best candidates for these APIs are real-time applications that run large processing loops, such as games, or those that stream data or video.
The dynamic APIs are shown in the image below.
The code sample below demonstrates the use of the dynamic APIs.
In the code below, an algorithm processes elements in an array.
The set_goal API specifies the desired number of elements per millisecond (e.g., 1000) for the application to process. The application then executes its logic, tracking the number of elements/ms processed, which it feeds into the regulate API.
regulate attempts to achieve the goal; if unsuccessful, it may try to increase the frequencies of the CPU cores to achieve it. On the other hand, if the number of elements/ms processed is greater than the goal, the API will decrease the frequencies of the CPU cores to save power.
clear_goal returns the system to its normal state.
That is an overview of the Power Optimization SDK, its components and how to use them. The main intent of the SDK is to help developers take advantage of the heterogeneous nature of the Snapdragon mobile platform while helping to reduce power consumption.