Reputation: 711
I need to know how many ticks of processor used by thread knowing its thread id. Because processor in PC is a synchronous device, if my thread is working, it takes processor time. I need to see what threads in my process are working. How can i do this? I'm using C++ in Visual Studio 2010
Upvotes: 0
Views: 539
Reputation: 129374
If you need to get thread statistics in your code, you can use GetThreadTimes
, which gives you a value for time used in kernel mode and time used in user mode for the thread given to the function. It gives you the total time, so if you want to measure how much CPU usage a thread has, you need to track the previous value (I started writing some code to show that, but since FILETIME
is not that easy to deal with, I gave up - I also can't testcompile it, since I don't have Windows machine...)
Upvotes: 4