java.lang.Object
oshi.driver.linux.proc.CpuStat
Utility to read CPU statistics from
/proc/stat
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
Gets the boot time from /proc/statstatic long
Gets the number of context switches from /proc/statstatic long
Gets the number of interrupts from /proc/statstatic long[][]
getProcessorCpuLoadTicks
(int logicalProcessorCount) Gets an arrya of Processor CPU ticks array from /proc/statstatic long[]
Gets the System CPU ticks array from/proc/stat
-
Method Details
-
getSystemCpuLoadTicks
public static long[] getSystemCpuLoadTicks()Gets the System CPU ticks array from/proc/stat
- Returns:
- Array of CPU ticks
-
getProcessorCpuLoadTicks
public static long[][] getProcessorCpuLoadTicks(int logicalProcessorCount) Gets an arrya of Processor CPU ticks array from /proc/stat- Parameters:
logicalProcessorCount
- The number of logical processors, which corresponds to the number of lines to read from the file.- Returns:
- Array of CPU ticks for each processor
-
getContextSwitches
public static long getContextSwitches()Gets the number of context switches from /proc/stat- Returns:
- The number of context switches if available, -1 otherwise
-
getInterrupts
public static long getInterrupts()Gets the number of interrupts from /proc/stat- Returns:
- The number of interrupts if available, -1 otherwise
-
getBootTime
public static long getBootTime()Gets the boot time from /proc/stat- Returns:
- The boot time if available, 0 otherwise
-