Search in sources :

Example 1 with OSProcess

use of oshi.software.os.OSProcess in project buck by facebook.

the class ProcessHelper method getProcessResourceConsumption.

/**
   * Gets resource consumption of the process with the given pid.
   */
@Nullable
public ProcessResourceConsumption getProcessResourceConsumption(long pid) {
    try {
        OperatingSystem os = OSHI.getOperatingSystem();
        OSProcess process = os.getProcess((int) pid);
        return getProcessResourceConsumptionInternal(process);
    } catch (Exception ex) {
        // do nothing
        return null;
    }
}
Also used : OperatingSystem(oshi.software.os.OperatingSystem) OSProcess(oshi.software.os.OSProcess) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 OSProcess (oshi.software.os.OSProcess)1 OperatingSystem (oshi.software.os.OperatingSystem)1