I'm basically trying to query private working set of a process in perl.
I have already refereed this post.
The solution works great on win8/8.1 but for some reason the following line returns nothing on win7x64 and I have tried using IDProcess instead of Name, it still returns no process.
my $proc = $objWMI->ExecQuery("select * from Win32_Process where Name=\'notepad\'");
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\.\\root\\cimv2');
$proc= $objWMI->ExecQuery("select * from Win32_PerfRawData_PerfProc_Process where Name=\'notepad\'");
foreach my $process (in($proc))
{
print "abc";
$out = $process->{WorkingSetPrivate};
}
So this thing doesn't work. Is there any different way of querying private working set size of a process in perl?
It seems like on windows 7 64 bit the performance counter was corrupted. I finally founded this post Corrupt Performance Counter
So I started cmd as admin and did lodctr /R (This basically reset your performance counters). After this, I was finally able to get the process, and this following code worked flawless :)
my $proc = $objWMI->ExecQuery("select * from Win32_PerfRawData_PerfProc_Process where Name=\'notepad\'");