public interface OperatingSystem
Modifier and Type | Interface and Description |
---|---|
static class |
OperatingSystem.OSVersionInfo |
static class |
OperatingSystem.ProcessSort
Controls sorting of Process output
|
Modifier and Type | Method and Description |
---|---|
int |
getBitness()
Gets the bitness (32 or 64) of the operating system.
|
OSProcess[] |
getChildProcesses(int parentPid,
int limit,
OperatingSystem.ProcessSort sort)
Gets currently running child processes of provided PID.
|
String |
getFamily()
Operating system family.
|
FileSystem |
getFileSystem()
Instantiates a
FileSystem object. |
String |
getManufacturer()
Manufacturer.
|
NetworkParams |
getNetworkParams()
Instantiates a
NetworkParams object. |
OSProcess |
getProcess(int pid)
Gets information on a currently running process
|
OSProcess |
getProcess(int pid,
boolean slowFields)
Gets information on a currently running process
|
long |
getProcessAffinityMask(int processId)
Retrieves the process affinity mask for the specified process.
|
int |
getProcessCount()
Get the number of processes currently running
|
OSProcess[] |
getProcesses()
Gets currently running processes.
|
List<OSProcess> |
getProcesses(Collection<Integer> pids)
Gets information on a currently running processes.
|
List<OSProcess> |
getProcesses(Collection<Integer> pids,
boolean slowFields)
Gets information on a currently running processes.
|
OSProcess[] |
getProcesses(int limit,
OperatingSystem.ProcessSort sort)
Gets currently running processes, optionally limited to the top "N" for a
particular sorting order.
|
OSProcess[] |
getProcesses(int limit,
OperatingSystem.ProcessSort sort,
boolean slowFields)
Gets currently running processes.
|
int |
getProcessId()
Gets the current process ID
|
OSService[] |
getServices()
Gets the all services on the system.
|
long |
getSystemBootTime()
Get Unix time of boot.
|
long |
getSystemUptime()
Get the System up time (time since boot).
|
int |
getThreadCount()
Get the number of threads currently running
|
OperatingSystemVersion |
getVersion()
Deprecated.
Use
getVersionInfo() |
OperatingSystem.OSVersionInfo |
getVersionInfo()
Operating system version information.
|
boolean |
isElevated()
Determine whether the current process has elevated permissions such as sudo /
Administrator
|
String getFamily()
String getManufacturer()
@Deprecated OperatingSystemVersion getVersion()
getVersionInfo()
OperatingSystem.OSVersionInfo getVersionInfo()
FileSystem getFileSystem()
FileSystem
object.FileSystem
object.OSProcess[] getProcesses()
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., commandlines and group information on Windows, open files on
Unix and Linux) will be skipped.OSProcess[] getProcesses(int limit, OperatingSystem.ProcessSort sort)
limit
- Max number of results to return, or 0 to return all resultssort
- If not null, determines sorting of resultsOSProcess
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.OSProcess[] getProcesses(int limit, OperatingSystem.ProcessSort sort, boolean slowFields)
limit
- Max number of results to return, or 0 to return all resultssort
- If not null, determines sorting of resultsslowFields
- 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.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.List<OSProcess> getProcesses(Collection<Integer> pids)
pids
- A collection of process IDsOSProcess
object for the specified
process ids if it is runningList<OSProcess> getProcesses(Collection<Integer> pids, boolean slowFields)
pids
- A collection of process IDsslowFields
- 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.OSProcess
object for the specified
process ids if it is runningOSProcess getProcess(int pid)
pid
- A process IDOSProcess
object for the specified
process id if it is running; null otherwiseOSProcess getProcess(int pid, boolean slowFields)
pid
- A process IDslowFields
- 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.OSProcess
object for the specified
process id if it is running; null otherwiseOSProcess[] getChildProcesses(int parentPid, int limit, OperatingSystem.ProcessSort sort)
parentPid
- A process IDlimit
- Max number of results to return, or 0 to return all resultssort
- If not null, determines sorting of resultsOSProcess
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.long getProcessAffinityMask(int processId)
On Windows systems with more than 64 processors, if the threads of the calling process are in a single processor group, returns the process affinity mask for that group (which may be zero if the specified process is running in a different group). If the calling process contains threads in multiple groups, returns zero.
If the Operating System fails to retrieve an affinity mask (e.g., the process has terminated), returns zero.
processId
- The process ID for which to retrieve the affinity.int getProcessId()
int getProcessCount()
int getThreadCount()
int getBitness()
long getSystemUptime()
long getSystemBootTime()
boolean isElevated()
NetworkParams getNetworkParams()
NetworkParams
object.NetworkParams
object.Copyright © 2010–2020 oshi. All rights reserved.