Package oshi.software.os
Interface OperatingSystem
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AbstractOperatingSystem
,FreeBsdOperatingSystem
,LinuxOperatingSystem
,MacOperatingSystem
,SolarisOperatingSystem
,WindowsOperatingSystem
public interface OperatingSystem extends java.io.Serializable
An operating system (OS) is the software on a computer that manages the way different programs use its hardware, and regulates the ways that a user controls the computer.- Author:
- dblock[at]dblock[dot]org
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
OperatingSystem.ProcessSort
Controls sorting of Process output
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.java.lang.String
getFamily()
Operating system family.FileSystem
getFileSystem()
Instantiates aFileSystem
object.java.lang.String
getManufacturer()
Manufacturer.NetworkParams
getNetworkParams()
Instantiates aNetworkParams
object.OSProcess
getProcess(int pid)
Gets information on a currently running processint
getProcessCount()
Get the number of processes currently runningOSProcess[]
getProcesses(int limit, OperatingSystem.ProcessSort sort)
Gets currently running processes.OSProcess[]
getProcesses(int limit, OperatingSystem.ProcessSort sort, boolean slowFields)
Gets currently running processes.java.util.List<OSProcess>
getProcesses(java.util.Collection<java.lang.Integer> pids)
Gets information on a currently running processes.int
getProcessId()
Gets the current process IDint
getThreadCount()
Get the number of threads currently runningOperatingSystemVersion
getVersion()
Operating system version.
-
-
-
Method Detail
-
getFamily
java.lang.String getFamily()
Operating system family.- Returns:
- String.
-
getManufacturer
java.lang.String getManufacturer()
Manufacturer.- Returns:
- String.
-
getVersion
OperatingSystemVersion getVersion()
Operating system version.- Returns:
- Version.
-
getFileSystem
FileSystem getFileSystem()
Instantiates aFileSystem
object.- Returns:
- A
FileSystem
object.
-
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 resultssort
- 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 resultssort
- If not null, determines sorting of resultsslowFields
- If false, skipOSProcess
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 IDlimit
- Max number of results to return, or 0 to return all resultssort
- 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.
-
getNetworkParams
NetworkParams getNetworkParams()
Instantiates aNetworkParams
object.- Returns:
- A
NetworkParams
object.
-
-