Software Power Analysis And Optimization For Power-Aware Multicore Systems