diff --git a/src/main/kotlin/top/fatweb/api/service/system/impl/StatisticsServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/system/impl/StatisticsServiceImpl.kt index be363fd..4cd152b 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/impl/StatisticsServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/impl/StatisticsServiceImpl.kt @@ -72,8 +72,8 @@ class StatisticsServiceImpl : IStatisticsService { val softirq = ticks[CentralProcessor.TickType.SOFTIRQ.index] - prevTicks[CentralProcessor.TickType.SOFTIRQ.index] val steal = ticks[CentralProcessor.TickType.STEAL.index] - prevTicks[CentralProcessor.TickType.STEAL.index] - - return CpuInfoVo(user, nice, system, idle, iowait, irq, softirq, steal, mutableListOf()).apply { + val total = user + nice + system + idle + iowait + irq + softirq + steal + return CpuInfoVo(user, nice, system, idle, iowait, irq, softirq, steal, total, mutableListOf()).apply { processorPrevTicksList.forEachIndexed { index, processorPrevTicks -> run { val processorTicks = processorTicksList[index] @@ -93,6 +93,7 @@ class StatisticsServiceImpl : IStatisticsService { processorTicks[CentralProcessor.TickType.SOFTIRQ.index] - processorPrevTicks[CentralProcessor.TickType.SOFTIRQ.index] val processorSteal = processorTicks[CentralProcessor.TickType.STEAL.index] - processorPrevTicks[CentralProcessor.TickType.STEAL.index] + val processorTotal = processorUser + processorNice + processorSystem + processorIdle + processorIowait + processorIrq + processorSoftirq + processorSteal processors?.add( CpuInfoVo( processorUser, @@ -102,7 +103,8 @@ class StatisticsServiceImpl : IStatisticsService { processorIowait, processorIrq, processorSoftirq, - processorSteal + processorSteal, + processorTotal ) ) } diff --git a/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt index 10c3534..63fb6fb 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt @@ -12,5 +12,6 @@ data class CpuInfoVo( val irq: Long, val softirq: Long, val steal: Long, + val total: Long, val processors: MutableList? = null )