C# Class System.Diagnostics.ProcessManager

Mostra file Open project: dotnet/corefx Class Usage Examples

Public Methods

Method Description
GetMainWindowHandle ( int processId ) : IntPtr
GetProcessIdFromHandle ( SafeProcessHandle processHandle ) : int

Gets the ID of a process from a handle to the process.

GetProcessIds ( ) : int[]

Gets the IDs of all processes on the current machine.

GetProcessIds ( string machineName ) : int[]

Gets the IDs of all processes on the specified machine.

GetProcessInfo ( int processId, string machineName ) : ProcessInfo

Gets the ProcessInfo for the specified process ID on the specified machine.

GetProcessInfos ( string machineName ) : System.Diagnostics.ProcessInfo[]

Gets process infos for each process on the specified machine.

IsProcessRunning ( int processId ) : bool

Gets whether the process with the specified ID is currently running.

IsProcessRunning ( int processId, string machineName ) : bool

Gets whether the process with the specified ID on the specified machine is currently running.

IsRemoteMachine ( string machineName ) : bool

Gets whether the named machine is remote or local.

OpenProcess ( int processId, int access, bool throwIfExited ) : SafeProcessHandle
OpenThread ( int threadId, int access ) : SafeThreadHandle

Private Methods

Method Description
ConvertOsxThreadFlagsToWaitReason ( Interop flags ) : System.Diagnostics.ThreadWaitReason
ConvertOsxThreadRunStateToThreadState ( Interop state ) : System.Diagnostics.ThreadState
CreateProcessInfo ( Interop procFsStat, System.Text.ReusableTextReader reusableReader ) : ProcessInfo

Creates a ProcessInfo from the data parsed from a /proc/pid/stat file and the associated tasks directory.

CreateProcessInfo ( int pid ) : ProcessInfo
CreateProcessInfo ( int pid, System.Text.ReusableTextReader reusableReader = null ) : ProcessInfo

Creates a ProcessInfo from the specified process ID.

EnumerateProcessIds ( ) : IEnumerable

Enumerates the IDs of all processes on the current machine.

GetModules ( int processId ) : ProcessModuleCollection

Gets an array of module infos for the specified process.

IsProcessRunning ( int processId, int processIds ) : bool
ProcFsStateToThreadState ( char c ) : ThreadState

Gets a ThreadState to represent the value returned from the status field of /proc/pid/stat.

ProcessManager ( ) : System.Collections.Generic
ThrowIfRemoteMachine ( string machineName ) : void

Method Details

GetMainWindowHandle() public static method

public static GetMainWindowHandle ( int processId ) : IntPtr
processId int
return IntPtr

GetProcessIdFromHandle() public static method

Gets the ID of a process from a handle to the process.
public static GetProcessIdFromHandle ( SafeProcessHandle processHandle ) : int
processHandle SafeProcessHandle The handle.
return int

GetProcessIds() public static method

Gets the IDs of all processes on the current machine.
public static GetProcessIds ( ) : int[]
return int[]

GetProcessIds() public static method

Gets the IDs of all processes on the specified machine.
public static GetProcessIds ( string machineName ) : int[]
machineName string The machine to examine.
return int[]

GetProcessInfo() public static method

Gets the ProcessInfo for the specified process ID on the specified machine.
public static GetProcessInfo ( int processId, string machineName ) : ProcessInfo
processId int The process ID.
machineName string The machine name.
return ProcessInfo

GetProcessInfos() public static method

Gets process infos for each process on the specified machine.
public static GetProcessInfos ( string machineName ) : System.Diagnostics.ProcessInfo[]
machineName string The target machine.
return System.Diagnostics.ProcessInfo[]

IsProcessRunning() public static method

Gets whether the process with the specified ID is currently running.
public static IsProcessRunning ( int processId ) : bool
processId int The process ID.
return bool

IsProcessRunning() public static method

Gets whether the process with the specified ID on the specified machine is currently running.
public static IsProcessRunning ( int processId, string machineName ) : bool
processId int The process ID.
machineName string The machine name.
return bool

IsRemoteMachine() public static method

Gets whether the named machine is remote or local.
public static IsRemoteMachine ( string machineName ) : bool
machineName string The machine name.
return bool

OpenProcess() public static method

public static OpenProcess ( int processId, int access, bool throwIfExited ) : SafeProcessHandle
processId int
access int
throwIfExited bool
return SafeProcessHandle

OpenThread() public static method

public static OpenThread ( int threadId, int access ) : SafeThreadHandle
threadId int
access int
return SafeThreadHandle