Package oshi.driver.linux.proc
Class ProcessStat
java.lang.Object
oshi.driver.linux.proc.ProcessStat
Utility to read process statistics from 
/proc/[pid]/stat- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumEnum corresponding to the fields in the output of/proc/[pid]/statstatic enumEnum corresponding to the fields in the output of/proc/[pid]/statm
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intConstant defining the number of integer values in/proc/pid/stat. 2.6 Kernel has 44 elements, 3.3 has 47, and 3.5 has 52.
- 
Method SummaryModifier and TypeMethodDescriptionstatic File[]getFileDescriptorFiles(int pid) Gets an array of files in the /proc/{pid}/fd directory.static File[]Gets an array of files in the /proc directory with only numeric digit filenames, corresponding to processesstatic Map<ProcessStat.PidStatM, Long> getPidStatM(int pid) Reads the statistics in/proc/[pid]/statmand returns the results.getPidStats(int pid) Reads the statistics in/proc/[pid]/statand returns the results.static OSProcess.StategetState(char stateValue) Returns Enum STATE for the state value obtained from status file of any process/thread.getThreadIds(int pid) Gets a List of thread ids for a process from the/proc/[pid]/task/directory with only numeric digit filenames, corresponding to the threads.Gets a map of sockets and their corresponding process ID
- 
Field Details- 
PROC_PID_STAT_LENGTHpublic static final int PROC_PID_STAT_LENGTHConstant defining the number of integer values in/proc/pid/stat. 2.6 Kernel has 44 elements, 3.3 has 47, and 3.5 has 52.
 
- 
- 
Method Details- 
getPidStatsReads the statistics in/proc/[pid]/statand returns the results.- Parameters:
- pid- The process ID for which to fetch stats
- Returns:
- A triplet containing the process name as the first element, a character representing the process state as
         the second element, and an EnumMap as the third element, where the numeric values in ProcessStat.PidStatare mapped to aLongvalue.If the process doesn't exist, returns null. 
 
- 
getPidStatMReads the statistics in/proc/[pid]/statmand returns the results.- Parameters:
- pid- The process ID for which to fetch stats
- Returns:
- An EnumMap where the numeric values in ProcessStat.PidStatMare mapped to aLongvalue.If the process doesn't exist, returns null. 
 
- 
getFileDescriptorFilesGets an array of files in the /proc/{pid}/fd directory.- Parameters:
- pid- id of process to read file descriptors for
- Returns:
- An array of File objects representing opened file descriptors of the process
 
- 
getPidFilesGets 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
 
- 
querySocketToPidMapGets a map of sockets and their corresponding process ID- Returns:
- a map with socket as the key and pid as the value
 
- 
getThreadIdsGets a List of thread ids for a process from the/proc/[pid]/task/directory with only numeric digit filenames, corresponding to the threads.- Parameters:
- pid- process id
- Returns:
- A list of thread id.
 
- 
getStateReturns Enum STATE for the state value obtained from status file of any process/thread.- Parameters:
- stateValue- state value from the status file
- Returns:
- OSProcess.State
 
 
-