Locating Infinite loops in Visual Studio 2005

  • Thread starter Thread starter Brian Stoop
  • Start date Start date
B

Brian Stoop

Hi,

1. I create a console application to create 10 differently named Threads.
2. Set each Thread to loop infinitely, sleeping every second.
3. Alter one of the threads to loop without any sleep..
4. Run the program in debug.

If you view Task manager, the program is taking 98-100% CPU.

Is there a way, of locating which Thread is responsible for the CPU outage,
without using breakpoints and deduction?

B.
 
I think a profiler will tell you how many CPU cycles each thread took.

The usual suspects are threads that are not sleeping, or having
something like:
System.Threading.Thread.Sleep(0);
 
Brian Stoop said:
Hi,

1. I create a console application to create 10 differently named
Threads.
2. Set each Thread to loop infinitely, sleeping every second.
3. Alter one of the threads to loop without any sleep..
4. Run the program in debug.

If you view Task manager, the program is taking 98-100% CPU.

Is there a way, of locating which Thread is responsible for the CPU
outage,
without using breakpoints and deduction?

B.
Maybe you can get the cputime on a per thread basis
 
Brian Stoop said:
Hi,

1. I create a console application to create 10 differently named
Threads.
2. Set each Thread to loop infinitely, sleeping every second.
3. Alter one of the threads to loop without any sleep..
4. Run the program in debug.

If you view Task manager, the program is taking 98-100% CPU.

Is there a way, of locating which Thread is responsible for the CPU
outage,
without using breakpoints and deduction?

B.
Maybe you can get the cputime on a per thread basis
 
Back
Top