# Function Reference

# ProcessGetStats

Returns an array about Memory or IO infos of a running process.

ProcessGetStats ( ["process" [, type = 0]] )

## Parameters

process | [optional] The name or PID of the process to get infos from. Default (-1) is the current process.
type | [optional] $PROCESS_STATS_MEMORY (0) = (default) memory infos. $PROCESS_STATS_IO (1) = IO infos. Constants are defined in "AutoItConstants.au3".

## Return Value

Success: | an array of infos data (See Remarks).
Failure: | sets the @error flag to non-zero.

## Remarks

The array returned is mono-dimensional and is made up as follows:
Type = $PROCESS_STATS_MEMORY
$aArray[0] = WorkingSetSize
$aArray[1] = PeakWorkingSetSize
Type = $PROCESS_STATS_IO
$aArray[0] = number of read operations performed.
$aArray[1] = number of write operations performed.
$aArray[2] = number of I/O operations performed, other than read and write operations.
$aArray[3] = number of bytes read.
$aArray[4] = number of bytes write.
$aArray[5] = number of bytes transferred during operations other than read and write operations.

## Related

ProcessList

## Example

    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        ; Retrieve memory details about the current process.
        Local $aMemory = ProcessGetStats()

        ; If $aMemory is an array then display the following details about the process.
        If IsArray($aMemory) Then
            MsgBox($MB_SYSTEMMODAL, "", "WorkingSetSize: " & $aMemory[0] & @CRLF & _
                    "PeakWorkingSetSize: " & $aMemory[1])
        Else
            MsgBox($MB_SYSTEMMODAL, "", "An error occurred.")
        EndIf
    EndFunc   ;==>Example