Class ProcstatUtil


  • @ThreadSafe
    public final class ProcstatUtil
    extends java.lang.Object
    Reads from procstat into a map
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ProcstatUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getCwd​(int pid)
      Gets current working directory info
      static java.util.Map<java.lang.Integer,​java.lang.String> getCwdMap​(int pid)
      Gets a map containing current working directory info
      static long getOpenFiles​(int pid)
      Gets open files
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProcstatUtil

        private ProcstatUtil()
    • Method Detail

      • getCwdMap

        public static java.util.Map<java.lang.Integer,​java.lang.String> getCwdMap​(int pid)
        Gets a map containing current working directory info
        Parameters:
        pid - a process ID, optional
        Returns:
        a map of process IDs to their current working directory. If pid is a negative number, all processes are returned; otherwise the map may contain only a single element for pid
      • getCwd

        public static java.lang.String getCwd​(int pid)
        Gets current working directory info
        Parameters:
        pid - a process ID
        Returns:
        the current working directory for that process.
      • getOpenFiles

        public static long getOpenFiles​(int pid)
        Gets open files
        Parameters:
        pid - The process ID
        Returns:
        the number of open files.