Loading ...
Sorry, an error occurred while loading the content.

1528Re: How to check memory usage in Windows with Perl?

Expand Messages
  • evenprime
    Oct 8, 2006
    • 0 Attachment
      # Don't think you can do that with gui-test, unless I missed somthing
      in spy--. Might be overkill to use the gui-test module. Might want
      to stick with wmi query via OLE:

      use Win32::OLE('in');
      use constant returnit => 0x10;
      use constant forwardit => 0x20;

      my $wmi = Win32::OLE->GetObject("winmgmts:\\\\.\\root\\CIMV2")
      or next;
      my $col =
      $wmi->ExecQuery( "SELECT * FROM Win32_Process", "WQL",
      returnit | forwardit );

      foreach my $item ( in $col) {
      $mem = $item->{WorkingSetSize} / 1024;
      $name = $item->{Caption};
      print "App: $name\n";
      print "Memory: $mem K\n\n";
      }
    • Show all 6 messages in this topic