Microarchitectural and System-Level Power Estimation and Optimization