mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
add improvements from oshi maintainer recommendations
This commit is contained in:
parent
22107a853a
commit
273177eb8f
@ -17,16 +17,14 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityimpl;
|
||||
|
||||
import oshi.SystemInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
import oshi.hardware.HardwareAbstractionLayer;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.DoubleSummaryStatistics;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CpuInfo {
|
||||
private final static Logger logger = LoggerFactory.getLogger(CpuInfo.class);
|
||||
@ -61,8 +59,8 @@ public class CpuInfo {
|
||||
}
|
||||
|
||||
public String getMhz() {
|
||||
// or use processor.getCurrentFreq, and average, or min?
|
||||
return Long.toString(processor.getMaxFreq()/ (1024*1024));
|
||||
double vendorFreq = processor.getProcessorIdentifier().getVendorFreq();
|
||||
return String.valueOf((long) (vendorFreq/1E6));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
@ -84,8 +82,8 @@ public class CpuInfo {
|
||||
public double getCurrentSpeed(int cpu) {
|
||||
double curFreq = getCurFreq(cpu);
|
||||
double maxFreq = getMaxFreq(cpu);
|
||||
if (Double.isNaN(curFreq) || Double.isNaN(maxFreq)) {
|
||||
return Double.NaN;
|
||||
if (curFreq < 0 || maxFreq < 0) {
|
||||
return -1;
|
||||
}
|
||||
return curFreq / maxFreq;
|
||||
}
|
||||
|
@ -51,7 +51,6 @@
|
||||
<netty.version>4.1.47.Final</netty.version>
|
||||
<!-- <netty.version>4.1.31.Final</netty.version>-->
|
||||
<number.to.words.version>1.0.0</number.to.words.version>
|
||||
<oshi.version>4.5.0</oshi.version>
|
||||
<slf4j.version>1.7.29</slf4j.version>
|
||||
<snakeyaml.version>1.23</snakeyaml.version>
|
||||
<snappy.version>1.1.2.6</snappy.version>
|
||||
@ -269,7 +268,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>${oshi.version}</version>
|
||||
<version>5.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
Loading…
Reference in New Issue
Block a user