Returning to the problem of measuring the cost of different operations for robot localization, I revisited the Spirals research group's PowerAPI toolkit for software power meters. In the time since I had last used PowerAPI, it appeared that the research group had discontinued development of the toolkit in favor of a new Python framework. However, since the Python framework is still a work in progress, I elected to continue using the original Scala toolkit which has been shown to be reasonably accurate alternative to a physical hardware power meter [1].
Previously, I used PowerAPI command line tool with only the procfs-cpu-simple
module that would use a power model to translate CPU usage to power consumption (milliWatts) using the CPU Thermal Design Power (TDP) value. However, this module only provides an estimate as the TDP value only indicates the maximum heat generated and does not take into account dynamic frequency scaling.
This week, I investigated the possibility of adding the cpu dvfs
module which in addition to the TDP value, also takes a mapping of frequencies and voltages for the CPU/ This should provide a better estimate of the power consumption as it takes into account situations in which the CPU may be thermally throttled. However, finding a table of frequencies and their corresponding voltages for the CPU was not a trivial task as I originally expected.
After reading through the official documentation for the Linux kernel, I determined that the CPU frequency and voltage is controlled by "p-states" which optimize for performance and power consumption [2]. Typically, changing the p-state in software would change the corresponding frequency and thus voltage. I inferred that if I were able to find a list of available p-states for the CPU, I could then translate it to a table of frequencies and voltages for PowerAPI. However, further reading indicated that Intel provides an alternative driver that has the option of controlling the CPU frequency and voltage independent of the software governer [3]. In this case, there would not be discrete p-states that could be translated to a table for PowerAPI. If this is the case, we may need to settle for the estimate provided by the procfs-cpu-simple
module.
References:
[1] Adel Noureddine, Romain Rouvoy, and Lionel Seinturier. 2013. A review of energy measurement approaches. SIGOPS Oper. Syst. Rev. 47, 3 (November 2013), 42-49. DOI: https://doi.org/10.1145/2553070.2553077
[2] CPU frequencies, Linux Kernel Documentation: https://www.kernel.org/doc/html/v4.12/admin-guide/pm/cpufreq.html
[3] Intel P-States, Linux Kernel Documentation: https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html