Interface OperatingSystem

    • Method Detail

      • getFamily

        java.lang.String getFamily()
        Operating system family.
        Returns:
        String.
      • getManufacturer

        java.lang.String getManufacturer()
        Manufacturer.
        Returns:
        String.
      • getProcesses

        OSProcess[] getProcesses​(int limit,
                                 OperatingSystem.ProcessSort sort)
        Gets currently running processes. If a positive limit is specified, returns only that number of processes; zero will return all processes. The order may be specified by the sort parameter, for example, to return the top cpu or memory consuming processes; if null, no order is guaranteed.
        Parameters:
        limit - Max number of results to return, or 0 to return all results
        sort - If not null, determines sorting of results
        Returns:
        An array of OSProcess objects for the specified number (or all) of currently running processes, sorted as specified. The array may contain null elements if a process terminates during iteration. Some fields that are slow to retrieve (e.g., group information on Windows, open files on Unix and Linux) will be skipped.
      • getProcesses

        OSProcess[] getProcesses​(int limit,
                                 OperatingSystem.ProcessSort sort,
                                 boolean slowFields)
        Gets currently running processes. If a positive limit is specified, returns only that number of processes; zero will return all processes. The order may be specified by the sort parameter, for example, to return the top cpu or memory consuming processes; if null, no order is guaranteed.
        Parameters:
        limit - Max number of results to return, or 0 to return all results
        sort - If not null, determines sorting of results
        slowFields - If false, skip OSProcess fields that are slow to retrieve (e.g., group information on Windows, open files on Unix and Linux). If true, include all fields, regardless of how long it takes to retrieve the data.
        Returns:
        An array of OSProcess objects for the specified number (or all) of currently running processes, sorted as specified. The array may contain null elements if a process terminates during iteration.
      • getProcess

        OSProcess getProcess​(int pid)
        Gets information on a currently running process
        Parameters:
        pid - A process ID
        Returns:
        An OSProcess object for the specified process id if it is running; null otherwise
      • getProcesses

        java.util.List<OSProcess> getProcesses​(java.util.Collection<java.lang.Integer> pids)
        Gets information on a currently running processes. This has improved performance on Windows based operating systems vs. iterating individual processes.
        Parameters:
        pids - A collection of process IDs
        Returns:
        An OSProcess object for the specified process ids if it is running
      • getChildProcesses

        OSProcess[] getChildProcesses​(int parentPid,
                                      int limit,
                                      OperatingSystem.ProcessSort sort)
        Gets currently running child processes of provided PID. If a positive limit is specified, returns only that number of processes; zero will return all processes. The order may be specified by the sort parameter, for example, to return the top cpu or memory consuming processes; if null, no order is guaranteed.
        Parameters:
        parentPid - A process ID
        limit - Max number of results to return, or 0 to return all results
        sort - If not null, determines sorting of results
        Returns:
        An array of OSProcess objects presenting the specified number (or all) of currently running child processes of the provided PID, sorted as specified. The array may contain null elements if a process terminates during iteration.
      • getProcessId

        int getProcessId()
        Gets the current process ID
        Returns:
        the Process ID of the current process
      • getProcessCount

        int getProcessCount()
        Get the number of processes currently running
        Returns:
        The number of processes running
      • getThreadCount

        int getThreadCount()
        Get the number of threads currently running
        Returns:
        The number of threads running
      • getBitness

        int getBitness()
        Gets the bitness (32 or 64) of the operating system.
        Returns:
        The number of bits supported by the operating system.