RAPL - get profiling to work and remove duplicate code.