Locating Infinite loops in Visual Studio 2005

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.
 
B

Batvanio

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);
 
J

Jesper Madsen

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
 
J

Jesper Madsen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top