Class AbstractHWDiskStore
java.lang.Object
oshi.hardware.common.AbstractHWDiskStore
- All Implemented Interfaces:
HWDiskStore
- Direct Known Subclasses:
AixHWDiskStore, FreeBsdHWDiskStore, LinuxHWDiskStore, MacHWDiskStore, NetBsdHWDiskStore, OpenBsdHWDiskStore, SolarisHWDiskStore, WindowsHWDiskStore
Common methods for platform HWDiskStore classes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected final AtomicReference<List<HWPartition>> protected longprotected longprotected longprotected longprotected longprotected long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractHWDiskStore(String name, String model, String serial, long size) Creates an AbstractHWDiskStore with unknown disk type.protectedAbstractHWDiskStore(String name, String model, String serial, long size, String diskType) Creates an AbstractHWDiskStore. -
Method Summary
Modifier and TypeMethodDescriptionlongThe length of the disk queue (#I/O's in progress).The type of the disk, such as SSD, HDD, Removable, Virtual, or Unknown.getModel()The disk modelgetName()The disk nameThe partitions on this disk.longThe number of bytes read from the disklonggetReads()The number of reads from the diskThe disk serial number, if available.longgetSize()The size of the disklongThe time this disk's statistics were updated.longThe time spent reading or writing, in milliseconds.longThe number of bytes written to the disklongThe number of writes to the diskprotected voidsetDiskStats(long reads, long readBytes, long writes, long writeBytes, long currentQueueLength, long transferTime, long timeStamp) Sets the disk statistics.protected voidsetPartitionList(List<HWPartition> partitionList) Sets the partition list.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HWDiskStore
updateAttributesModifier and TypeMethodDescriptionbooleanMake a best effort to update all the statistics about the drive without needing to recreate the drive list.
-
Field Details
-
reads
protected volatile long reads -
readBytes
protected volatile long readBytes -
writes
protected volatile long writes -
writeBytes
protected volatile long writeBytes -
currentQueueLength
protected volatile long currentQueueLength -
transferTime
protected volatile long transferTime -
timeStamp
protected volatile long timeStamp -
partitionList
-
-
Constructor Details
-
AbstractHWDiskStore
-
AbstractHWDiskStore
-
-
Method Details
-
getName
Description copied from interface:HWDiskStoreThe disk name- Specified by:
getNamein interfaceHWDiskStore- Returns:
- the name
-
getModel
Description copied from interface:HWDiskStoreThe disk model- Specified by:
getModelin interfaceHWDiskStore- Returns:
- the model
-
getSerial
Description copied from interface:HWDiskStoreThe disk serial number, if available.- Specified by:
getSerialin interfaceHWDiskStore- Returns:
- the serial number
-
getSize
public long getSize()Description copied from interface:HWDiskStoreThe size of the disk- Specified by:
getSizein interfaceHWDiskStore- Returns:
- the disk size, in bytes
-
getDiskType
Description copied from interface:HWDiskStoreThe type of the disk, such as SSD, HDD, Removable, Virtual, or Unknown.- Specified by:
getDiskTypein interfaceHWDiskStore- Returns:
- the disk type string
-
getReads
public long getReads()Description copied from interface:HWDiskStoreThe number of reads from the disk- Specified by:
getReadsin interfaceHWDiskStore- Returns:
- the reads
-
getReadBytes
public long getReadBytes()Description copied from interface:HWDiskStoreThe number of bytes read from the disk- Specified by:
getReadBytesin interfaceHWDiskStore- Returns:
- the bytes read
-
getWrites
public long getWrites()Description copied from interface:HWDiskStoreThe number of writes to the disk- Specified by:
getWritesin interfaceHWDiskStore- Returns:
- the writes
-
getWriteBytes
public long getWriteBytes()Description copied from interface:HWDiskStoreThe number of bytes written to the disk- Specified by:
getWriteBytesin interfaceHWDiskStore- Returns:
- the bytes written
-
getCurrentQueueLength
public long getCurrentQueueLength()Description copied from interface:HWDiskStoreThe length of the disk queue (#I/O's in progress). Includes I/O requests that have been issued to the device driver but have not yet completed. Not supported on macOS.- Specified by:
getCurrentQueueLengthin interfaceHWDiskStore- Returns:
- the current disk queue length
-
getTransferTime
public long getTransferTime()Description copied from interface:HWDiskStoreThe time spent reading or writing, in milliseconds.- Specified by:
getTransferTimein interfaceHWDiskStore- Returns:
- the transfer time
-
getTimeStamp
public long getTimeStamp()Description copied from interface:HWDiskStoreThe time this disk's statistics were updated.- Specified by:
getTimeStampin interfaceHWDiskStore- Returns:
- the timeStamp, in milliseconds since the epoch.
-
getPartitions
Description copied from interface:HWDiskStoreThe partitions on this disk.- Specified by:
getPartitionsin interfaceHWDiskStore- Returns:
- an
UnmodifiableListof the partitions on this drive.
-
setDiskStats
protected void setDiskStats(long reads, long readBytes, long writes, long writeBytes, long currentQueueLength, long transferTime, long timeStamp) Sets the disk statistics.- Parameters:
reads- number of readsreadBytes- bytes readwrites- number of writeswriteBytes- bytes writtencurrentQueueLength- current I/O queue lengthtransferTime- time spent on transfers in mstimeStamp- timestamp of the measurement
-
setPartitionList
Sets the partition list.- Parameters:
partitionList- the partition list
-
toString
-