Background: --------------- PowerTOP is a tool used to provide information related to power consumption, from various sources, into one screen. One of the issues with PowerTOP is that the number of C and P states are hardcoded and thus it doesn't provide complete information on systems which may have more states than the hardcoded ones. Thus, though it works well on intel platforms, it may not on some of the ARM boards.
Changes being suggested: --------------------------------- These are couple of simple patches which try to make PowerTOP generic enough to run on almost any platform, which is plugged into the cpufreq and cpuidle framework. Thus the number of C and P states will no longer be hardcoded (though, the MAX values will be, to allocate enough memory for data structures). Most of the changes required is to make the display be aware of the ACTUAL number of these states and not just depend on some hard coded values.
Where to get the source and patches: ----------------------------------------------- You can get it from the git repo located at git://git.linaro.org/amitarora/powertop.git
The "master" branch has the PowerTOP code in sync with latest upstream powertop git tree. The "linaro" branch has my patches, which need testing. So, once you clone the tree, please do not forget to checkout the "linaro" branch (git checkout -b linaro remotes/origin/linaro)!
Note: If you had cloned it before, please clone a fresh tree, since I have re-written the history for "linaro" branch, to get patches in shape for upstream submission. Something, which I know should be avoided in future.
What to review: -------------------- Once you checkout the "linaro" branch, as suggested above. You can review the two patches with commit id "09049b42e3" and "783a3e6bbe".
What to test: ---------------- Some of the things which could be tested is, o Compile and test on any ARM board that you may have. You can also test on any x86 / x86_64 systems, to check if nothing has been broken. o Compare the output from "master" and "linaro" branches ("-d" dump option may help, if you wish to take a diff) o Check if the number of C states is correct (/sys/devices/system/cpu/cpu0/cpuidle/) o Check if the number of P states is correct (/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies) o Check if the % values makes sense (say, if total doesn't add to 100! Or, if its a very huge value [1] ). o If number of Wakeups-per-second [1] looks reasonable. o Top causes for wakeups is shown properly o Suggestions are shown properly. Some of the suggestions may show a hot key on the status bar (at bottom).
[1] There is a known issue of %age values and Wakeups-per-sec number being shown very high (in the order of thousands), if some key is hit (say, 'r' to refresh or any other key). This problem can be seen in "master" branch (upstream) too, and hence is not introduced by the new patches. Since the goal of these patches is different, I haven't addressed this issue here.
Note: Thanks a ton to people who tested my initial patches and provided their valuable feedback.
Thanks ! Regards, Amit Arora