Skip to content
Merged
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
Expand Up @@ -32,14 +32,12 @@ public class MacOSPowermetricsSensor implements PowerSensor {
public MacOSPowermetricsSensor() {
// extract metadata
try {
final var exec = new ProcessBuilder().command("sudo", "powermetrics", "--samplers cpu_power", "-i 10", "-n 1").start();
if (exec.waitFor(20, TimeUnit.MILLISECONDS)) {
this.cpu = initMetadata(exec.getInputStream());
} else {
throw new IllegalStateException("Couldn't execute powermetrics to extract metadata");
}
final var exec = new ProcessBuilder()
.command("sudo", "powermetrics", "--samplers", "cpu_power", "-i", "10", "-n", "1")
.start();
this.cpu = initMetadata(exec.getInputStream());
} catch (Exception e) {
throw new RuntimeException(e);
throw new RuntimeException("Couldn't execute powermetrics to extract metadata", e);
}
}

Expand Down