Optimize hardware information
This commit is contained in:
@@ -4,6 +4,7 @@ import org.springframework.stereotype.Service
|
|||||||
import oshi.SystemInfo
|
import oshi.SystemInfo
|
||||||
import top.fatweb.api.properties.ServerProperties
|
import top.fatweb.api.properties.ServerProperties
|
||||||
import top.fatweb.api.service.system.IStatisticsService
|
import top.fatweb.api.service.system.IStatisticsService
|
||||||
|
import top.fatweb.api.util.ByteUtil
|
||||||
import top.fatweb.api.vo.system.HardwareInfoVo
|
import top.fatweb.api.vo.system.HardwareInfoVo
|
||||||
import top.fatweb.api.vo.system.SoftwareInfoVo
|
import top.fatweb.api.vo.system.SoftwareInfoVo
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
@@ -39,6 +40,8 @@ class StatisticsServiceImpl : IStatisticsService {
|
|||||||
cpuPhysicalPackageCount = systemInfo.hardware.processor.physicalPackageCount,
|
cpuPhysicalPackageCount = systemInfo.hardware.processor.physicalPackageCount,
|
||||||
cpuPhysicalProcessorCount = systemInfo.hardware.processor.physicalProcessorCount,
|
cpuPhysicalProcessorCount = systemInfo.hardware.processor.physicalProcessorCount,
|
||||||
cpuLogicalProcessorCount = systemInfo.hardware.processor.logicalProcessorCount,
|
cpuLogicalProcessorCount = systemInfo.hardware.processor.logicalProcessorCount,
|
||||||
microarchitecture = systemInfo.hardware.processor.processorIdentifier.microarchitecture
|
microarchitecture = systemInfo.hardware.processor.processorIdentifier.microarchitecture,
|
||||||
|
memories = "${ByteUtil.formatByteSize(systemInfo.hardware.memory.total)} (${systemInfo.hardware.memory.physicalMemory.joinToString(" + ") { ByteUtil.formatByteSize(it.capacity) }})",
|
||||||
|
disks = "${ByteUtil.formatByteSize(systemInfo.hardware.diskStores.sumOf { it.size })} (${systemInfo.hardware.diskStores.joinToString(" + ") {ByteUtil.formatByteSize(it.size)}})"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -7,5 +7,7 @@ data class HardwareInfoVo(
|
|||||||
val cpuPhysicalPackageCount: Int,
|
val cpuPhysicalPackageCount: Int,
|
||||||
val cpuPhysicalProcessorCount: Int,
|
val cpuPhysicalProcessorCount: Int,
|
||||||
val cpuLogicalProcessorCount: Int,
|
val cpuLogicalProcessorCount: Int,
|
||||||
val microarchitecture: String
|
val microarchitecture: String,
|
||||||
|
val memories: String,
|
||||||
|
val disks: String
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user