in reply to Tracking memory of a running application
Getting the info for the current process with Win32::Process::Info just requires you pass the current pid ($$) to GetProcInfo(). The hash returned (as the first element of the array) contains the following keys. I've indicated the keys that relate to the figures shown in the task manager/pslist:
perl> use Win32::Process::Info;; perl> $p = Win32::Process::Info->new;; perl> @i = $p->GetProcInfo( $$ );; perl> $h = $i[0];; perl> print "$_ => ", $h->{ $_ } || 'n/a' for keys %$h;; TerminationDate => n/a QuotaNonPagedPoolUsage => 3800 ParentProcessId => 1172 Status => n/a OSName => Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddi +sk0\Partition1 CSName => D4KG9X0J PeakPageFileUsage => 5103616 PageFileUsage => 4186112 QuotaPeakNonPagedPoolUsage => 3920 WorkingSetSize => 3887104 .......## This is the tasklist "Mem Usage" +figure. CreationDate => 1130168062 HandleCount => 103 WindowsVersion => 5.1.2600 PeakWorkingSetSize => 7254016 MaximumWorkingSetSize => 1413120 PeakVirtualSize => 142602240 WriteOperationCount => 2 SessionId => n/a PrivatePageCount => 4186112 .....## This is the tasklist "VM Size" fi +gure Owner => D4KG9X0J\Me ProcessId => 188 Caption => perl.exe CommandLine => c:\perl\bin\perl.exe -sw "c:\Perl\bin\p1.pl" OSCreationClassName => Win32_OperatingSystem Priority => 8 MinimumWorkingSetSize => 204800 CreationClassName => Win32_Process ThreadCount => 7 KernelModeTime => 0.328125 ExecutionState => n/a CSCreationClassName => Win32_ComputerSystem InstallDate => n/a WriteTransferCount => 144 OtherTransferCount => 203274 PageFaults => 2758 VirtualSize => 142602240 QuotaPagedPoolUsage => 25776 OwnerSid => S-1-5-21-756011271-1152625135-639526082-1005 ReadTransferCount => 347129 OtherOperationCount => 3358 ReadOperationCount => 171 QuotaPeakPagedPoolUsage => 25808 ExecutablePath => c:\perl\bin\perl.exe UserModeTime => 0.265625 Name => perl.exe Description => perl.exe Handle => 188
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tracking memory of a running application
by DrWhy (Chaplain) on Oct 24, 2005 at 20:14 UTC | |
by BrowserUk (Patriarch) on Oct 24, 2005 at 22:12 UTC | |
by DrWhy (Chaplain) on Oct 25, 2005 at 21:11 UTC | |
by BrowserUk (Patriarch) on Oct 26, 2005 at 01:19 UTC | |
by DrWhy (Chaplain) on Oct 26, 2005 at 16:32 UTC |