Class ProcUtil

java.lang.Object
oshi.util.platform.linux.ProcUtil

public class ProcUtil
extends java.lang.Object
Provides access to some /proc filesystem info on Linux
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String CPUINFO
    The proc path for CPU information
    static java.lang.String STAT
    The proc path for CPU statistics
  • Method Summary

    Modifier and Type Method Description
    static java.io.File[] getPidFiles()
    Gets an array of files in the /proc directory with only numeric digit filenames, corresponding to processes
    static java.lang.String getProcPath()
    The proc filesystem location may be customized to allow alternative proc plugins, particularly useful for containers.
    static double getSystemUptimeSeconds()
    Parses the first value in /proc/uptime for seconds since boot
    static long[] readSystemCpuLoadTicks()
    Gets the CPU ticks array from /proc/stat

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getProcPath

      public static java.lang.String getProcPath()
      The proc filesystem location may be customized to allow alternative proc plugins, particularly useful for containers.
      Returns:
      The proc filesystem path, with a leading / but not a trailing one, e.g., "/proc"
    • getSystemUptimeSeconds

      public static double getSystemUptimeSeconds()
      Parses the first value in /proc/uptime for seconds since boot
      Returns:
      Seconds since boot
    • readSystemCpuLoadTicks

      public static long[] readSystemCpuLoadTicks()
      Gets the CPU ticks array from /proc/stat
      Returns:
      Array of CPU ticks
    • getPidFiles

      public static java.io.File[] getPidFiles()
      Gets an array of files in the /proc directory with only numeric digit filenames, corresponding to processes
      Returns:
      An array of File objects for the process files