For low power applications a proper configuration of the CPU compiler (code generation tools) setting is important. Compiler settings can influence the application runtime behavior significantly depending on the compiler options used. Typically an application may be compiled for speed or size depending on the preferred user setting. Optimizing for size will create a smaller application but typically will lead to a longer run-time. Optimizing for speed will create an application that runs faster but the application size will increase. A faster running application usually requires less time to execute and therefor requires less overall power.
Individual functions in an application may also be measured for power consumption. Hence if a user knows how much power each individual function uses in the application, the overall power consumption can be optimized more efficiently for lower power consumption without increasing the application size a great deal. An embodiment of the invention describes how compiler settings may be derived from data extracted by EnergyTrace (U.S. patent application Ser. No. 13/329,073) and be passed to the compiler.
In an embodiment of the invention a compiler may be configured to provide a low-power application by first compiling the application settings that optimize for size of the application and running it on a CPU. While the CPU is running, power measurements are obtained for a number of the functions in the application. One tool that may be used to obtain these power measurements is EnergyTrace. Energy Trace provides runtime data of the application power consumption. After the power measurements are obtained, the application is stopped from running on the CPU. From the power measurements, a set of functions used in the application are identified as using the majority of power on the application.
Next the complier is set to maximize the speed of the set of functions. After setting the compiler settings, the application is recompiled. After recompiling, the application is run on the CPU. While the application is being run on the CPU, power is measured again. After the power is measured, the application is stopped from running and the power from rerun is reported. The power may be reported using a graphical user interface (GUI). The above method may be repeated to obtain even lower power usage.