2

I was wondering if there exist power profiling tool for programs which reports results at source code level. For example, profiling results which report the power consumption at specific source code lines, functions, modules, etc.

For me is not important the language and platform. Just want to know if there is such animal.

feradz
  • 1,312
  • 1
  • 16
  • 29

1 Answers1

2

There is research being done on this right now at universities, but it’s still in an experimental stage, and I’m not aware of commercial tools for this yet.

A professor at my alma mater is working on this, and he calls it Green Mining: The Effect of Software Change on Power Consumption. Right now it involves hooking up a Kill-a-Watt with USB to another computer and recording lots of data while running controlled tests on the software. For mobile devices it gets even more complicated, because you have to wire up circuit boards to measure the power drain on the battery in real time:

mobile phone power monitoring setup

Eventually there will be statistical models that, based on data gathered by running power tests over all sorts of other code, will be able to give you power profiles of source code without all this hardware. Your IDE will warn you: “Are you sure you want to do that? That will reduce average laptop battery life by 3 minutes compared to this other way of doing it.” That is a very long way off, though.

I do vaguely remember hearing that one of the initial results was that the depth of the class inheritance hierarchy is positively correlated with power consumption … Browse these papers if you’re interested!

andrewdotn
  • 32,721
  • 10
  • 101
  • 130
  • + "depth of the class inheritance ... correlated with power". That's certainly my experience re. software performance. The pattern is that data structure classes are way over-designed and full of `new`s and event processing so they are orders of magnitude slower than truly necessary. [*1 example here.*](http://stackoverflow.com/a/927773/23771) If computation takes electrical power, that's going to suck battery, big time. – Mike Dunlavey Jan 23 '13 at 17:11
  • @andrew thanks for the information. I have tumbled upon differen ongoing research. Also, I threw a quick look on GreenMining but it is not actually what I was asking. GreenMining is more after showing power consumption differences between two program versions -- this is still very powerful solution. In the research domain there is [EProf](http://research.microsoft.com/en-us/people/mzh/eurosys-2012.pdf) which seems most relevant that I am interested in. – feradz Jan 23 '13 at 22:42
  • @Mike Dunlavey I looked through the series of optimizations you have made. I find the result remarkable. Certainly any level of indirection adds a cost to the runtime and the runtime directly correlates to the power consumption - the longer a program runs the more power it consumes. However, all these indirections provide us benefits and the runtime/power is the price we pay for them. This trade offs must be well understood by everybody. It would be interesting to identify strategies which are unique for power optimization. – feradz Jan 23 '13 at 23:03
  • @feradz: None of those optimizations gave up functionality. That's the point. All but the simplest programs, as written, tend to have huge opportunities for speedup without loss of features. The reason they are not often found is that most programmers do not know how to look for them and simply don't suspect they are there. [*This link*](http://scicomp.stackexchange.com/a/2719/1262) shows how the statistics works to get big speedups, without giving up anything. It seems like magic, but many programmers are quite practiced at it. – Mike Dunlavey Jan 24 '13 at 00:12