Skip to content

Commit

Permalink
3.7.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis committed Jul 28, 2018
1 parent 2c3bbe6 commit b8b7fab
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 63 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
3.7.0 (in progress)
3.8.0 (in progress)
================
* Your contribution here.

3.7.0 (07/28/2018)
================
* [#551](https://github.com/oshi/oshi/pull/551): Check for zero-length PDH counter lists to avoid exceptions - [@dbwiddis](https://github.com/dbwiddis).
* [#556](https://github.com/oshi/oshi/pull/556): WMI timeouts, standardization, and simplification. - [@dbwiddis](https://github.com/dbwiddis).
Expand All @@ -7,7 +11,6 @@
* [#564](https://github.com/oshi/oshi/pull/564): Cache WMI connections. - [@dbwiddis](https://github.com/dbwiddis).
* [#567](https://github.com/oshi/oshi/pull/567): Cache USB devices. - [@dbwiddis](https://github.com/dbwiddis).
* [#569](https://github.com/oshi/oshi/pull/569): Remove threetenbp dependency. - [@dbwiddis](https://github.com/dbwiddis).
* Your contribution here.

3.6.2 (7/10/18)
================
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Downloads
---------
| Stable Release Version | Current Development Version | Dependencies |
| ------------- | ------------- | ------------- |
| [oshi-core-3.6.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.github.oshi&a=oshi-core&v=3.6.2&e=jar) | [oshi-core-3.7.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.oshi&a=oshi-core&v=3.7.0-SNAPSHOT&e=jar) | [JNA](https://github.com/java-native-access/jna)[SLF4J](http://www.slf4j.org/) |
| [oshi-json-3.6.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.github.oshi&a=oshi-json&v=3.6.2&e=jar) | [oshi-json-3.7.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.oshi&a=oshi-json&v=3.7.0-SNAPSHOT&e=jar) | [javax.json](https://jsonp.java.net/download.html) |
| [oshi-core-3.7.0](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.github.oshi&a=oshi-core&v=3.7.0&e=jar) | [oshi-core-3.8.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.oshi&a=oshi-core&v=3.8.0-SNAPSHOT&e=jar) | [JNA](https://github.com/java-native-access/jna)[SLF4J](http://www.slf4j.org/) |
| [oshi-json-3.7.0](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.github.oshi&a=oshi-json&v=3.7.0&e=jar) | [oshi-json-3.8.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.oshi&a=oshi-json&v=3.8.0-SNAPSHOT&e=jar) | [javax.json](https://jsonp.java.net/download.html) |

Projects using OSHI
-------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,20 +497,19 @@ protected void updateProcessorTicks() {
// through branch prediction if it doesn't
for (long[] tick : ticks) {
for (long element : tick) {
if (element == 0L) {
continue;
if (element != 0L) {
// We have a nonzero tick array, update and return!
this.procTickTime = System.currentTimeMillis();
// Copy to previous
for (int cpu = 0; cpu < this.logicalProcessorCount; cpu++) {
System.arraycopy(this.curProcTicks[cpu], 0, this.prevProcTicks[cpu], 0,
this.curProcTicks[cpu].length);
}
for (int cpu = 0; cpu < this.logicalProcessorCount; cpu++) {
System.arraycopy(ticks[cpu], 0, this.curProcTicks[cpu], 0, ticks[cpu].length);
}
return;
}
// We have a nonzero tick array, update and return!
this.procTickTime = System.currentTimeMillis();
// Copy to previous
for (int cpu = 0; cpu < this.logicalProcessorCount; cpu++) {
System.arraycopy(this.curProcTicks[cpu], 0, this.prevProcTicks[cpu], 0,
this.curProcTicks[cpu].length);
}
for (int cpu = 0; cpu < this.logicalProcessorCount; cpu++) {
System.arraycopy(ticks[cpu], 0, this.curProcTicks[cpu], 0, ticks[cpu].length);
}
return;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void setVersion(String version) {
}

/**
* @param string
* @param releaseDate
* The releaseDate to set.
*/
public void setReleaseDate(String releaseDate) {
Expand Down
2 changes: 1 addition & 1 deletion oshi-core/src/main/java/oshi/jna/platform/linux/Udev.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Udev.UdevDevice udev_device_get_parent_with_subsystem_devtype(Udev.UdevDevice ud

Udev.UdevListEntry udev_list_entry_get_next(Udev.UdevListEntry list_entry);

String udev_device_get_sysattr_value(final Udev.UdevDevice udev_device, final String sysattr);
String udev_device_get_sysattr_value(Udev.UdevDevice udev_device, String sysattr);

int udev_enumerate_add_match_subsystem(Udev.UdevEnumerate udev_enumerate, String subsystem);

Expand Down
10 changes: 5 additions & 5 deletions oshi-core/src/main/java/oshi/jna/platform/windows/WinPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface WinPerf extends com.sun.jna.platform.win32.WinPerf {
* @see <A HREF=
* "https://msdn.microsoft.com/en-us/library/windows/desktop/aa373157(v=vs.85).aspx">PERF_DATA_BLOCK</A>
*/
public class PERF_DATA_BLOCK extends Structure {
class PERF_DATA_BLOCK extends Structure {
public char[] Signature = new char[4];
public int LittleEndian;
public int Version;
Expand Down Expand Up @@ -80,7 +80,7 @@ protected List<String> getFieldOrder() {
* @see <A HREF=
* "https://msdn.microsoft.com/en-us/library/windows/desktop/aa373159(v=vs.85).aspx">PERF_INSTANCE_DEFINITION</A>
*/
public class PERF_INSTANCE_DEFINITION extends Structure {
class PERF_INSTANCE_DEFINITION extends Structure {
public int ByteLength;
public int ParentObjectTitleIndex;
public int ParentObjectInstance;
Expand Down Expand Up @@ -113,7 +113,7 @@ protected List<String> getFieldOrder() {
* "https://msdn.microsoft.com/en-us/library/windows/desktop/aa373160(v=vs.85).aspx">
* PERF_OBJECT_TYPE</A>
*/
public class PERF_OBJECT_TYPE extends Structure {
class PERF_OBJECT_TYPE extends Structure {
public int TotalByteLength;
public int DefinitionLength;
public int HeaderLength;
Expand Down Expand Up @@ -153,7 +153,7 @@ protected List<String> getFieldOrder() {
* "https://msdn.microsoft.com/en-us/library/windows/desktop/aa373150(v=vs.85).aspx">
* PERF_COUNTER_DEFINITION</A>
*/
public class PERF_COUNTER_DEFINITION extends Structure {
class PERF_COUNTER_DEFINITION extends Structure {
public int ByteLength;
public int CounterNameTitleIndex;
public int CounterNameTitle; // always 32 bit
Expand Down Expand Up @@ -190,7 +190,7 @@ protected List<String> getFieldOrder() {
* "https://msdn.microsoft.com/en-us/library/windows/desktop/aa373147(v=vs.85).aspx">
* PERF_COUNTER_BLOCK</A>
*/
public class PERF_COUNTER_BLOCK extends Structure {
class PERF_COUNTER_BLOCK extends Structure {
public int ByteLength;

public PERF_COUNTER_BLOCK() {
Expand Down
3 changes: 2 additions & 1 deletion oshi-core/src/main/java/oshi/util/ParseUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public static long unsignedIntToLong(int unsignedValue) {
*/
public static long cimDateTimeToMillis(String cimDate) {
try {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, Integer.parseInt(cimDate.substring(0, 4)));
// Calendar uses 0-indexed months
c.set(Calendar.MONTH, Integer.parseInt(cimDate.substring(4, 6)) - 1);
Expand All @@ -353,6 +353,7 @@ public static long cimDateTimeToMillis(String cimDate) {
c.set(Calendar.SECOND, Integer.parseInt(cimDate.substring(12, 14)));
c.set(Calendar.MILLISECOND, Integer.parseInt(cimDate.substring(15, 18)));
// Offset from UTC is in minutes
c.setTimeZone(TimeZone.getTimeZone("UTC"));
return c.getTimeInMillis() + Integer.parseInt(cimDate.substring(22)) * 60_000L;
} catch (StringIndexOutOfBoundsException | // If cimDate not 22+ chars
NumberFormatException e) { // If the fields didn't parse
Expand Down
15 changes: 4 additions & 11 deletions oshi-core/src/main/java/oshi/util/platform/mac/SmcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public static int smcReadKey(String key, SMCVal val, int retries) {

inputStructure.key = (int) ParseUtil.strToLong(key, 4);
int result;
// These calls frequently result in kIOReturnIPCError so retry multiple
// times with small delay
int retry = 0;
do {
result = smcGetKeyInfo(inputStructure, outputStructure);
Expand Down Expand Up @@ -243,16 +245,7 @@ public static int smcReadKey(String key, SMCVal val, int retries) {
* @return 0 if successful, nonzero if failure
*/
public static int smcCall(int index, SMCKeyData inputStructure, SMCKeyData outputStructure) {
int structureInputSize = inputStructure.size();
IntByReference structureOutputSizePtr = new IntByReference(outputStructure.size());

int result = IOKit.INSTANCE.IOConnectCallStructMethod(conn.getValue(), index, inputStructure,
structureInputSize, outputStructure, structureOutputSizePtr);
if (result != 0) {
// This frequently resulted in kIOReturnIPCError in testing. TODO
// find out why!
}
// Success
return result;
return IOKit.INSTANCE.IOConnectCallStructMethod(conn.getValue(), index, inputStructure, inputStructure.size(),
outputStructure, new IntByReference(outputStructure.size()));
}
}
26 changes: 13 additions & 13 deletions oshi-core/src/main/java/oshi/util/platform/windows/WmiUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ public enum ValueType {
// in the enumerateProperties method.
}

/**
* Interface contract for WMI Property Enums used with the {@link WmiQuery}
* and {@link WmiResult} classes.
*/
public interface WmiProperty {
/**
* Gets the ValueType.
*
* @return The type of value this property returns
*/
ValueType getType();
}

/**
* Enum used for WMI namespace query.
*/
Expand All @@ -167,6 +154,19 @@ public ValueType getType() {
private static final WmiQuery<NamespaceProperty> NAMESPACE_QUERY = createQuery("ROOT", "__NAMESPACE",
NamespaceProperty.class);

/**
* Interface contract for WMI Property Enums used with the {@link WmiQuery}
* and {@link WmiResult} classes.
*/
public interface WmiProperty {
/**
* Gets the ValueType.
*
* @return The type of value this property returns
*/
ValueType getType();
}

/**
* Helper class wrapping information required for a WMI query.
*/
Expand Down
11 changes: 5 additions & 6 deletions oshi-core/src/test/java/oshi/hardware/DisksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package oshi.hardware;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -48,11 +47,11 @@ public void testDisks() throws IOException {

HWDiskStore lastDisk = new HWDiskStore();
for (HWDiskStore disk : si.getHardware().getDiskStores()) {
assertTrue(disk.equals(disk));
assertFalse(disk.equals(null));
assertFalse(disk.equals("A String"));
assertFalse(disk.equals(lastDisk));
assertFalse(disk.hashCode() == lastDisk.hashCode());
assertEquals(disk, disk);
assertNotEquals(disk, null);
assertNotEquals(disk, "A String");
assertNotEquals(disk, lastDisk);
assertNotEquals(disk.hashCode(), lastDisk.hashCode());
HWPartition[] parts = disk.getPartitions();
HWPartition[] partArray = new HWPartition[parts.length];
for (int i = 0; i < partArray.length; i++) {
Expand Down
11 changes: 5 additions & 6 deletions oshi-json/src/test/java/oshi/json/hardware/DisksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package oshi.json.hardware;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -48,11 +47,11 @@ public void testDisks() throws IOException {

HWDiskStore lastDisk = new HWDiskStore();
for (HWDiskStore disk : si.getHardware().getDiskStores()) {
assertTrue(disk.equals(disk));
assertFalse(disk.equals(null));
assertFalse(disk.equals("A String"));
assertFalse(disk.equals(lastDisk));
assertFalse(disk.hashCode() == lastDisk.hashCode());
assertEquals(disk, disk);
assertNotEquals(disk, null);
assertNotEquals(disk, "A String");
assertNotEquals(disk, lastDisk);
assertNotEquals(disk.hashCode(), lastDisk.hashCode());
HWPartition[] parts = disk.getPartitions();
HWPartition[] partArray = new HWPartition[parts.length];
for (int i = 0; i < partArray.length; i++) {
Expand Down
7 changes: 5 additions & 2 deletions src/site/markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ memory & CPU usage, disks & partitions, devices, sensors, etc.
OSHI provides lightweight Java objects to enable the core functionality in the `oshi-core` module,
and extends that with flexible, configurable JSON-formatted data in the `oshi-json` module.

Many thanks to the authors of the [jProfile Java Profiler](https://www.ej-technologies.com/products/jprofiler/overview.html)
for their support of Open Source projects including OSHI.

Essentials
----------
* [Find OSHI on Maven Central](http://search.maven.org/#search|ga|1|com.github.oshi)
Expand Down Expand Up @@ -55,8 +58,8 @@ Downloads
---------
| Stable Release Version | Current Development Version | Dependencies |
| ------------- | ------------- | ------------- |
| [oshi-core-3.6.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.github.oshi&amp;a=oshi-core&amp;v=3.6.2&amp;e=jar) | [oshi-core-3.7.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.github.oshi&amp;a=oshi-core&amp;v=3.7.0-SNAPSHOT&amp;e=jar) | [JNA](https://github.com/java-native-access/jna)[SLF4J](http://www.slf4j.org/)[threetenbp](http://www.threeten.org/threetenbp/) |
| [oshi-json-3.6.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.github.oshi&amp;a=oshi-json&amp;v=3.6.2&amp;e=jar) | [oshi-json-3.7.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.github.oshi&amp;a=oshi-json&amp;v=3.7.0-SNAPSHOT&amp;e=jar) | [javax.json](https://jsonp.java.net/download.html) |
| [oshi-core-3.7.0](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.github.oshi&amp;a=oshi-core&amp;v=3.7.0&amp;e=jar) | [oshi-core-3.8.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.github.oshi&amp;a=oshi-core&amp;v=3.8.0-SNAPSHOT&amp;e=jar) | [JNA](https://github.com/java-native-access/jna)[SLF4J](http://www.slf4j.org/) |
| [oshi-json-3.7.0](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=com.github.oshi&amp;a=oshi-json&amp;v=3.7.0&amp;e=jar) | [oshi-json-3.8.0-SNAPSHOT](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&amp;g=com.github.oshi&amp;a=oshi-json&amp;v=3.8.0-SNAPSHOT&amp;e=jar) | [javax.json](https://jsonp.java.net/download.html) |

Projects using OSHI
-------------------
Expand Down

0 comments on commit b8b7fab

Please sign in to comment.