In Process Explorer terms it is WS Private Bytes, whereas in Task Manager terms it is Private Working Set.
I would like a command line utility to display this information given a process name.
EDIT
A powershell script will do as well.
In Process Explorer terms it is WS Private Bytes, whereas in Task Manager terms it is Private Working Set.
I would like a command line utility to display this information given a process name.
EDIT
A powershell script will do as well.
In PowerShell
you may use:
[EDIT]
function ProcessInfo
{
param
([String]$processName)
$workingSet = get-counter -counter "\Process($processName)\Working Set - Private" | select -expandproperty countersamples | select cookedvalue
$privateBytes = get-counter -counter "\Process($processName)\Private Bytes" | select -expandproperty countersamples | select cookedvalue
get-process $processName | select `
name, `
@{Name="Private Working Set"; Expression = {$workingSet.CookedValue}},`
@{Name="WS Private Bytes"; Expression = {$privateBytes.CookedValue}}
}
ProcessInfo("winrar")
[EDIT2]
Here's an improved version which takes the process id as a parameter.
function GetProcessInfoById
{
param
([int]$processId)
Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process | where{$_.idprocess -eq $processId} | select `
@{Name="Process Id"; Expression = {$_.idprocess}},`
@{Name="Counter Name"; Expression = {$_.name}},`
@{Name="Private Working Set"; Expression = {$_.workingSetPrivate / 1kb}}
}
GetProcessInfoById 380
And here's an version which takes the process name as a parameter. This may return multiple values (one for each instance of the process) and you can identify processes by the values by the Process Id
.
function GetProcessInfoByName
{
param
([string]$processName)
Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process | where{$_.name -like $processName+"*"} | select `
@{Name="Process Id"; Expression = {$_.idprocess}},`
@{Name="Counter Name"; Expression = {$_.name}},`
@{Name="Private Working Set"; Expression = {$_.workingSetPrivate / 1kb}}
}
GetProcessInfoByName svchost