This seems like a pretty difficult task to measure because you cannot isolate one process yourself. In fact, if you try to do this, you will have difficulty defining what constitutes the “only process” - is it just user space code belonging to this program? Or do you include kernel code executed on behalf of the program? What if the OS optimizes the kernel code so that similar requests from different programs are processed together using an almost constant amount of energy? Then you could not even highlight the use of energy by the program.
In that case, my tendency would be to measure the expected value, basically the average amount of energy used by the application. Ideally, you should start with a large number of systems, all the same, except that half of them have an application, and half of them are not. Let each system work under any operating conditions that you want to test (the same conditions for all devices, of course, except that half of them launch the application, and half do not) and either measure the speed of energy by consumption using the standard API, or for the batteries to discharge and measure how long it takes for each unit to discharge the battery. Then compare the average result with the devices that ran the application and the average result from those that were not, and you can find out how much the program increases the power consumption of the computer.
source share