开发者

Can we optimize code to reduce power consumption?

Ar开发者_JAVA百科e there any techniques to optimize code in order to ensure lesser power consumption.Architecture is ARM.language is C


From the ARM technical reference site:

The features of the ARM11 MPCore processor that improve energy efficiency include:

  • accurate branch and sub-routine return prediction, reducing the number of incorrect instruction fetch and decode operations
  • use of physically addressed caches, which reduces the number of cache flushes and refills, saving energy in the system
  • the use of MicroTLBs reduces the power consumed in translation and protection lookups each cycle
  • the caches use sequential access information to reduce the number of accesses to the tag RAMs and to unwanted data RAMs.

In the ARM11 MPCore processor extensive use is also made of gated clocks and gates to disable inputs to unused functional blocks. Only the logic actively in use to perform a calculation consumes any dynamic power.

Based on this information, I'd say that the processor does a lot of work for you to save power. Any power wastage would come from poorly written code that does more processing than necessary, which you wouldn't want anyway. If you're looking to save power, the overall design of your application will have more effect. Network access, screen rendering, and other power-hungry operations will be of more concern for power consumption.


Optimizing code to use less power is, effectively, just optimizing code. Regardless of whether your motives are monetary, social, politital or the like, fewer CPU cycles = less energy used. What I'm trying to say is I think you can probably replace "power consumption" with "execution time", as they would, essentially, be directly proportional - and you therefore may have more success when not "scaring" people off with a power-related question. I may, however, stand corrected :)


Yes. Use a profiler and see what routines are using most of the CPU. On ARM you can use some JTAG connectors, if available (I used Lauterbach both for debugging and for profiling). The main problem is generally to put your processor, when in idle, in a low-consumption state (deep sleep). If you cannot reduce the CPU percentage used by much (for example from 80% to 50%) it won't make a big difference. Depending on what operating systems you are running the options may vary.


The July 2010 edition of the Communications of the ACM has an article on energy-efficient algorithms which might interest you. I haven't read it yet so cannot impart any of its wisdom.


Try to stay in on chip memory (cache) for idle loops, keep I/O to a minimum, keep bit flipping to a minimum on busses. NV memory like proms and flash consume more power to store zeros than ones (which is why they erase to ones, it is actually a zero but the transitor(s) invert the bit before you see it, zeros stored as ones, ones stored as zeros, this is also why they degrade to ones when they fail), I dont know about volatile memories, dram uses half as many transistors as sram, but has to be refreshed.

For all of this to matter though you need to start with a lower power system as the above may not be noticeable. dont use anything from intel for example.


If you are not running Windows XP+ or a newer version of Linux, you could run a background thread which does nothing but HLT.

This is how programs like CPUIdle reduce power consumption/heat.


If the processor is tuned to use less power when it needs less cycles, then simply making your code run more efficiently is the solution. Else, there's not much you can do unless the operating system exposes some sort of power management functionality.


Keep IO to a minimum.


On some ARM processors it's possible to reduce power consumption by putting the voltage regulator in standby mode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜