If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

how to measure power consumed by algorithms

i've to make a program in c/c++ through which we can find out the power consumed by any algorithm(basically a c/c++ program).... here we are assuming we know the specific processor we are working on....can u please tell me the functions or commands that can be used to do so and the logic behind it.... if there's any paper or website where info of this sort is available please let me kno...if theres no way to measure power consumption for any generic processor then we can take intel pentium 4 as the processor on which we have to measure the power consumed..

Re: how to measure power consumed by algorithms

I'm not certain how possible it is to predict the CPU time without actually running it on the processor. If running it, then asking windows how long it took is sufficient then there's a functiona available then look into the windows api function:GetThreadTimes

If you need to be able to predict it and you have a lot of development time available then you could possibly look up the processor timings in the intel manuals for each processor instruction. If you are considdering this then then be sure that you're not going to be stopped by the Halting problem before you start development.

Re: how to measure power consumed by algorithms

thanks for replying..... I will actually run the program on the processor to determine the power consumption..... Assuming if I know the number of cpu clock ticks that were taken to execute the program... How will we proceed further to determine the power consumed...

Re: how to measure power consumed by algorithms

Originally Posted by shivamskn

thanks for replying..... I will actually run the program on the processor to determine the power consumption..... Assuming if I know the number of cpu clock ticks that were taken to execute the program... How will we proceed further to determine the power consumed...

I don't believe algorithms consume power. The cpu is running whether you're giving it anything to do. Moving disc heads around would consume more electricity than when the disc is idle, but to the best of my knowledge, cpu power consumption would be constant.

Re: how to measure power consumed by algorithms

my college project requires me to do so..... I've to basically run an algorithm on a computer using c/c++ and then the same algorithm is to be executed using an fpga and then I've have to compare the amount of power consumption using the 2 methods and determine which was better... As per me there will be some power consumption dependent on the amount of resources of the processor utilised

Re: how to measure power consumed by algorithms

Thats going to be dificult.

My best guess would be to see if you can determine the power usage of the PC per second then just multiply the CPU time of the process by the power usage of your computer.

Beyond that its very hard to define because even when your process isnt running then your OS will be sitting there in a loop saying have I got anything else to do yet? ... no...
have I got anything else to do yet? ... no...
and unless this part of the OS knows how to throttle down your CPU then it will take about as much power as your algorithm.

Re: how to measure power consumed by algorithms

Originally Posted by shivamskn

my college project requires me to do so..... I've to basically run an algorithm on a computer using c/c++ and then the same algorithm is to be executed using an fpga and then I've have to compare the amount of power consumption using the 2 methods and determine which was better... As per me there will be some power consumption dependent on the amount of resources of the processor utilised

Re: how to measure power consumed by algorithms

nah we are actually talking abt power consumed.... the project has got something to do with adaptive systems.... does any1 of u kno wat is the per cycle power consumption of a p4 processor without ht technology....

Re: how to measure power consumed by algorithms

Originally Posted by shivamskn

nah we are actually talking abt power consumed.... the project has got something to do with adaptive systems.... does any1 of u kno wat is the per cycle power consumption of a p4 processor without ht technology....

You can find long lists of power consumption on the Intel website, but AFAIK those are fairly theoretical values - typically idle and maximum power consumption. I don't think you'll get any sensible values about power consumption without actually measuring power consumption.

Cheers, D Drmmr

Please put [code][/code] tags around your code to preserve indentation and make it more readable.

As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky