  Energy efficiency can have a significant influence on user experience of
mobile devices such as smartphones and tablets. Although energy is consumed by
hardware, software optimization plays an important role in saving energy, and
thus software developers have to participate in the optimization process. The
source code is the interface between the developer and hardware resources. In
this paper, we propose an energy-optimization framework guided by a source code
energy model that allows developers to be aware of energy usage induced by the
code and to apply very targeted source-level refactoring strategies. The
framework also lays a foundation for the code optimization by automatic tools.
To the best of our knowledge, our work is the first that achieves this for a
high-level language such as Java. In a case study, the experimental evaluation
shows that our approach is able to save from 6.4% to 50.2% of the CPU energy
consumption in various application scenarios.
