c++ - How can i know thread name for PDH from thread id -


i need check context switches thread. i'm writing function, return context switches thread id. i'm computing context switch counts using pdh library. can thread context switch count threads using construction:

status = pdhaddcounter(query, resultbuffer, null, &counter); 

where resultbuffer "thread(_total/_total)\\context switches/sec"

what have change (_total/_total)?

some playing around perfmon suggests format should be

thread(<process name>/<thread id>)\\context switches/sec 

the thread id have; can process name process id using answers this question.


Comments