Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible/easy to determine how much power a program is using?

Is it possible to determine or even reasonably estimate how much power a program is using? The idea being to profile my code in terms of power consumption instead of just typical performance.

Is it enough to measure CPU use, GPU use and memory access?

like image 609
Alec Jacobson Avatar asked Jan 03 '14 15:01

Alec Jacobson


People also ask

How can you tell how much power something is using?

The wattage of most appliances is usually stamped on the bottom or back of the appliance, or on its nameplate. The wattage listed is the maximum power drawn by the appliance. Many appliances have a range of settings, so the actual amount of power an appliance may consume depends on the setting being used.

Can you measure power usage?

Electricity is measured in Watts and kilowatts Some devices require only a few Watts to operate, and other devices require larger amounts. The power consumption of small devices is usually measured in Watts, and the power consumption of larger devices is measured in kilowatts (kW), or 1,000 Watts.

How do I tell how much power my computer is using?

Use a P3 Kill-A-Watt electricity-usage monitor If you want to get the best readings for the overall power usage of your computer, you will need to measure the connection from a wall outlet with an external power meter, such as a P3 Kill-A-Watt Electricity Monitor.


1 Answers

There are many aspects that can influence the power consumption of an application, and these will vary a lot depending on the used hardware.

The easiest way to get an idea is to measure it. If your program is doing heavy calculations, it is quite simple to measure the difference. Just read out the usage while the app is running, and subtract the usage while not.

If your app is not of the heavy calculations kind, then the challenge is allot bigger, since a simple 1 point in time comparison will not do the trick. You could get a measuring device that can log usage over time, which log you would need to compare with the logged process activity of your machine and try to filter all other scheduled tasks (checks for updates etc) out.

Just a tip if you want to go this way, APC's UPS's come with this functionality built-in, and the PowerChute software stores a power consumption log in an Access Database (C:\Program Files\APC\PowerChute Personal Edition\EnergyLog.mdb). I'm not sure if this is true for all models, but it was a nice extra feature that came with mine (Pro 550). I would lay the data alongside an Xperf trace (the free built in profiler in Windows, look here for an overview), in order to correlate power variations with your applications activity, and filter out scheduled jobs etc...

That said, remember you will get different results on different hardware. An ssd will differ from a tradational harddisk, and the used grafix adapter can also make a difference, so you could only get a rough estimation overall, by measuring on a "typical" system. Desktop systems will consume allot more than laptops, etc... (also see this blogpost).

Power consumption profiling tools are allot more common for mobile devices. I'm not an expert in that field, but I know there are quite some tools out there.

like image 50
Louis Somers Avatar answered Oct 04 '22 23:10

Louis Somers