Analysis, Modeling and Optimization of Execution Time and Energy for Parallel Programs