Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.laprun.sustainability.power;

import java.util.Arrays;

/**
* A power consumption measure as recorded by a sensor, recorded over a given period of time. The meaning of each component
* measure is provided by the {@link SensorMetadata} information associated
Expand Down Expand Up @@ -70,4 +72,9 @@ default double externalCPUShare() {
*/
SensorMeasure missing = new SensorMeasure() {
};

default String asString() {
return getClass().getSimpleName() + '(' + startMs() + ',' + endMs() + " -> duration: " + durationMs() + ')'
+ Arrays.toString(components());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public boolean isPartial() {
public double externalCPUShare() {
return cpuShare;
}

@Override
public String toString() {
return asString() + " extCPU: " + externalCPUShare();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
* @param endMs the end timestamp in milliseconds for this measure
*/
public record NoDurationSensorMeasure(double[] components, long startMs, long endMs) implements SensorMeasure {
@Override
public String toString() {
return asString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@
*/
public record PartialSensorMeasure(double[] components, long startMs, long endMs,
long durationMs) implements SensorMeasure {
@Override
public boolean isPartial() {
return true;
}

@Override
public String toString() {
return asString();
}
}