Code for %CPU &Thread Count of a process RRS feed

  • Question

  • Does any one know the code to return the %CPU usage and Thread Count of a process?  I am able to retrieve all Task Manager counters using APIs except for CPU Usage and Thread Count.

    Thanks in Advance

    Wednesday, June 7, 2006 3:13 AM

All replies

  • A little question - how this related to PsTools?

    ZwQuerySystemInformation the answer for you
    Wednesday, June 7, 2006 3:15 AM
  • Thanks for your reply.  The reason I asked in psTools topic is because I see the pslist tool returns %CPU Usage and Thread Count for any or all processes.

    The ZwQuerySystemInformation is for NT.  I am using 2000/XP.


    Wednesday, June 7, 2006 5:50 AM
  • 2000/XP are the same NT
    Wednesday, June 7, 2006 11:31 AM
  • PsTools uses WMI
    Wednesday, June 7, 2006 11:32 AM
  • I'm just remember,

    for thread (if you don't know what is ZwQuery... and what is XP/2000)


    Gives you all threads

    For CPU Usage you will need read data from Registry.
    Wednesday, June 7, 2006 11:48 AM