Power and Performance: Software Analysis and Optimization