The energy value I got from PCM counters seems only depends on execution time, more time, more energy. I performed a test (result shown in attachment), which performs the same amount of work load, and varies the frequency. The higher frequency, execution time decreases, energy decreases as well, which is counter-intuitive, since energy grows cubic with frequency, but time decrease linearly with frequency. In principle, even if execution time decreases, the energy cost should be higher. The same happens when I use more cores, more cores lead to shorter execution time, but turn more cores from C6 state to C0 state. But still the energy curve follows strictly with time curves. The processor I used is Intel Xeon E2630L, the the code I use to extract energy is as follows, is there sth wrong in my code?
PCM *m = PCM::getInstance();
if(m->program() != PCM::Success) return EXIT_FAILURE;
SystemCounterState before_sstate = getSystemCounterState();
SystemCounterState after_sstate = getSystemCounterState();
printf("MEASURE: %f\n", getConsumedJoules(before_sstate, after_sstate));