K
Ken Durden
Is there a way to measure or ask .NET to tell me what amount of time a
thread spent actually executing on the CPU?
For example, I may spawn a thread that spends 99.9% of its time
waiting for an event to be set, and then performs some action. If the
thread runs for 10 hours, how can I find out what amount of that time
was spent doing real execution.
For a simple example, I could measure this myself... For example, if I
just had a loop that waited for an event to be set I could put a high
performance timer everytime I got into the body of the loop and
increment a total time before going back into my wait mode.
However, if my code in turn calls lots of other functions which may
also block waiting on some asynchronous action this gets really
complicated and kinda infeasible if the other code is out of my
control.
Therefore, I was hoping for some magic API call that gives me this
info.
Any ideas?
Thanks,
-ken
thread spent actually executing on the CPU?
For example, I may spawn a thread that spends 99.9% of its time
waiting for an event to be set, and then performs some action. If the
thread runs for 10 hours, how can I find out what amount of that time
was spent doing real execution.
For a simple example, I could measure this myself... For example, if I
just had a loop that waited for an event to be set I could put a high
performance timer everytime I got into the body of the loop and
increment a total time before going back into my wait mode.
However, if my code in turn calls lots of other functions which may
also block waiting on some asynchronous action this gets really
complicated and kinda infeasible if the other code is out of my
control.
Therefore, I was hoping for some magic API call that gives me this
info.
Any ideas?
Thanks,
-ken