CPU monitoring

This is a discussion on CPU monitoring within the Windows Programming forums, part of the Platform Specific Boards category; Does anyone know how to monitor the cpu usage of a process or thread? I think it has something to ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    3

    CPU monitoring

    Does anyone know how to monitor the cpu usage of a process or thread? I think it has something to do with certain entries in the registry being modified by the system in real time, but I couldn't find those entries on my computer.

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Forget the registry!

    Take a look at this function:
    Code:
    BOOL GetProcessTimes(
      HANDLE hProcess,           // handle to process
      LPFILETIME lpCreationTime, // process creation time
      LPFILETIME lpExitTime,     // process exit time
      LPFILETIME lpKernelTime,   // process kernel-mode time
      LPFILETIME lpUserTime      // process user-mode time
    );
    If you want other processs information, perhaps these functions are of interest:
    Code:
    BOOL GetProcessIoCounters(
      HANDLE hProcess,           // handle to process
      PIO_COUNTERS lpIoCounters  // I/O accouting information
    );
    
    BOOL GetProcessMemoryInfo(
      HANDLE Process,                          // handle to process
      PPROCESS_MEMORY_COUNTERS ppsmemCounters, // buffer
      DWORD cb                                 // size of buffer
    );
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pthread question
    By quantt in forum Linux Programming
    Replies: 7
    Last Post: 04-07-2009, 01:21 AM
  2. questions on multiple thread programming
    By lehe in forum C Programming
    Replies: 11
    Last Post: 03-27-2009, 07:44 AM
  3. Upgrading my old CPU (for another old one!)
    By foxman in forum Tech Board
    Replies: 16
    Last Post: 01-11-2008, 04:41 PM
  4. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 05:57 PM
  5. CPU temp
    By PING in forum Tech Board
    Replies: 5
    Last Post: 01-28-2006, 05:25 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21