Skip to content

Commit

Permalink
fix: properly start and stop measure on update
Browse files Browse the repository at this point in the history
  • Loading branch information
metacosm committed Nov 12, 2023
1 parent bbe4bb9 commit c7f846c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ private double computeNewComponentValue(int componentIndex, long sensorValue, do

@Override
public void update(OngoingPowerMeasure ongoingMeasure) {
ongoingMeasure.startNewMeasure();
double cpuShare = PowerMeasurer.instance().cpuShareOfJVMProcess();
for (int i = 0; i < raplFiles.length; i++) {
final var value = raplFiles[i].extractPowerMeasure();
final var newComponentValue = computeNewComponentValue(i, value, cpuShare);
ongoingMeasure.setComponent(i, newComponentValue);
lastMeasuredSensorValues[i] = newComponentValue;
}
ongoingMeasure.stopMeasure();
}

@Override
Expand Down

0 comments on commit c7f846c

Please sign in to comment.