Monitoring thread performance

This is a discussion on Monitoring thread performance within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to profile a system with a number of threads. If I look at the process/threads using process explorer ...

  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855

    Monitoring thread performance

    I'm trying to profile a system with a number of threads.

    If I look at the process/threads using process explorer (from sysinternals), I can see a thread context switch rate, and a total number of context switches.

    Finding the switch rate through WMI seems easy enough.
    But the total number of context switches - mmm, tricky.

    Several hours with the Thread API on MSDN didn't help, except to suggest some deprecated API, and that didn't go into enough detail to help either.

    I figured the information was easy enough to collect, and there must be some way to get at it since PE does.

    Thanks for any insight,
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    This is a site dedicated to hidden API functions and/or functions that are not in the SDK docs.

    http://undocumented.ntinternals.net/

    Hope it helps.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by Bubba View Post
    This is a site dedicated to hidden API functions and/or functions that are not in the SDK docs.

    http://undocumented.ntinternals.net/

    Hope it helps.
    There is nothing undocumented.
    It's a (sadly well-known...) poor site.
    Just read Wine or ReactOS source, and you'll get 10 x more apis.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    I've used that site to call functions that were not in the SDK docs and they worked fine. Granted I would not rely on them since they are not officially supported and could change at any time.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Possibly use the PDH library to create a performance counter for acquiring the number of system/context switches or thread/context switches??????

    EDIT: Maybe this link can be of some help to you. Especially, the source code example.
    Last edited by BobS0327; 08-03-2008 at 07:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 02:17 PM
  2. thread termination
    By arjunajay in forum Windows Programming
    Replies: 3
    Last Post: 06-27-2006, 12:32 AM
  3. CreateThread ?!
    By Devil Panther in forum Windows Programming
    Replies: 13
    Last Post: 11-15-2005, 10:55 AM
  4. pointer to main thread from worker thread?
    By draegon in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2005, 07:35 AM
  5. Critical Sections, destroying
    By Hunter2 in forum Windows Programming
    Replies: 4
    Last Post: 09-02-2003, 11:36 PM

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