in reply to Re: Thread Counts
in thread Thread Counts

Other options include using Win32::API and calling standard Win32 API functions, OR using Win32::OLE and WMI like so:

use strict; use Win32::OLE; my $WMI = Win32::OLE->GetObject("winmgmts:"); my $Procs = $WMI->InstancesOf("Win32_Process"); foreach my $Proc (in $Procs) { printf( "PID %u has %u threads.\n", $Proc->ProcessId, $Proc->ThreadCount, ); }

Very quick & easy. The Win32_Process class has other valuable properties too. See the class documentation @ MSDN for more info.