2

This is a continuation to How much time spent in a .NET Thread?

I know how I can measure cpu time of a thread (http://www.codeproject.com/KB/dotnet/ExecutionStopwatch.aspx), but I don't know how to measure IO wait of a thread. Thread waits for IO, gets interrupted. While other threads executing, IO operation of our thread long over, we return to our thread, we stop Stopwatch, but it shows incorrectly large time. Any ideas on this?

Community
  • 1
  • 1
ren
  • 3,843
  • 9
  • 50
  • 95

1 Answers1

1

Do you need this done in code specifically? If you use WinDbg you can use the !runaway to get the CPU time of each thread for both Kernel and User Mode http://blogs.msdn.com/b/debuggingtoolbox/archive/2009/08/20/special-command-cpu-time-for-each-thread-with-runaway.aspx.

Alternatively you can use ProcessExplorer. If you double click on the process you can get this information on the thread tab. http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx.

Alternatively this thread on C++ How to get the cpu usage per thread on windows (win32) has information on the Win32 API calls.

Community
  • 1
  • 1
btlog
  • 4,760
  • 2
  • 29
  • 38