Monitor the cpu usage in a program modules

G

Giuseppe³

Hi everybody

I have a program wrote in Visual Studio C# that has been developed in
the time by many programmers.

Now I note that when the program seems to be inactive (all the windows
and data processing are not active) the program sometimes use a lot of
cpu time (about 60%) in a single core computers.

My question is: there is a tool that I can use to monitor the cpu usage
in each module? I have think to cut the program to isolate the module
incriminated, but if there is a mode to do it without modify the program
I prefer.

Thank you for your attention
Giuseppe
 
M

Marcel Müller

Hi everybody

I have a program wrote in Visual Studio C# that has been developed in
the time by many programmers.

Now I note that when the program seems to be inactive (all the windows
and data processing are not active) the program sometimes use a lot of
cpu time (about 60%) in a single core computers.

My question is: there is a tool that I can use to monitor the cpu usage
in each module?

Solution #1: a .NET profiler will show you what is going on in your code
and help to isolate hot spots. There are many profilers around, e.g. ants.

Solution #2: run the program in the debugger but without breakpoints.
Wait until the problem arises. Press halt. It is very likely that you
capture a thread somewhere where the CPU cycles are burned. Simply take
a look at the callstack and repeat the procedure a few times.


Marcel
 
G

Giuseppe³

Il 09/03/14 08:16, Marcel Müller ha scritto:
Solution #1: a .NET profiler will show you what is going on in your code
and help to isolate hot spots. There are many profilers around, e.g. ants.

Solution #2: run the program in the debugger but without breakpoints.
Wait until the problem arises. Press halt. It is very likely that you
capture a thread somewhere where the CPU cycles are burned. Simply take
a look at the callstack and repeat the procedure a few times.

Thank you Marcel,

I'm looking for the profiler.

Regards
Giuseppe
 
A

Arne Vajhøj

I have a program wrote in Visual Studio C# that has been developed in
the time by many programmers.

Now I note that when the program seems to be inactive (all the windows
and data processing are not active) the program sometimes use a lot of
cpu time (about 60%) in a single core computers.

My question is: there is a tool that I can use to monitor the cpu usage
in each module? I have think to cut the program to isolate the module
incriminated, but if there is a mode to do it without modify the program
I prefer.

You can try with a profiler.

But there are a few potential gotchas.

A profiler may impact the application and either make the application
unusable or make the problem disappear.

If the problem is not in your code, but in CLR/.NET framework code or
in underlying Win32 or kernel code, then it may not show anything.

Your description could maybe fit with a garbage collection problem.

Arne
 
G

Giuseppe³

Il 12/03/14 02:25, Arne Vajhøj ha scritto:
You can try with a profiler.

But there are a few potential gotchas.

A profiler may impact the application and either make the application
unusable or make the problem disappear.

If the problem is not in your code, but in CLR/.NET framework code or
in underlying Win32 or kernel code, then it may not show anything.

Your description could maybe fit with a garbage collection problem.

Hi,

thank youbut I think that the problem is in some routine in my code.
I try to do ever the same command sequence and ever at the end I have
the same result with the cpu usage over 60%.
I'm sure that in the final condition the program should be in a state
that not use a lot of cpu time.

I'm trying to understand how to use the profiler to find which module
remains activated.

Regards
Giuseppe
 

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