-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
runtime/src/main/java/io/quarkiverse/power/runtime/sensors/StoppedPowerMeasure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package io.quarkiverse.power.runtime.sensors; | ||
|
||
import java.util.Optional; | ||
|
||
import io.quarkiverse.power.runtime.PowerMeasure; | ||
import io.quarkiverse.power.runtime.SensorMeasure; | ||
|
||
public class StoppedPowerMeasure<M extends SensorMeasure> implements SensorMeasure, PowerMeasure<M> { | ||
private final M measure; | ||
private final long duration; | ||
private final int samples; | ||
|
||
public StoppedPowerMeasure(PowerMeasure<M> powerMeasure) { | ||
this.measure = powerMeasure.sensorMeasure(); | ||
this.duration = powerMeasure.duration(); | ||
this.samples = powerMeasure.numberOfSamples(); | ||
} | ||
|
||
@Override | ||
public double cpu() { | ||
return measure.cpu(); | ||
} | ||
|
||
@Override | ||
public Optional<Double> gpu() { | ||
return measure.gpu(); | ||
} | ||
|
||
@Override | ||
public Optional<Double> byKey(String key) { | ||
return measure.byKey(key); | ||
} | ||
|
||
@Override | ||
public double total() { | ||
return measure.total(); | ||
} | ||
|
||
@Override | ||
public int numberOfSamples() { | ||
return samples; | ||
} | ||
|
||
@Override | ||
public long duration() { | ||
return duration; | ||
} | ||
|
||
@Override | ||
public M sensorMeasure() { | ||
return measure; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters