Unable to run CPU trace profiling on a remote application

Questions about YourKit .NET Profiler
Post Reply
rkanoong
Posts: 3
Joined: Thu Feb 18, 2010 5:39 pm

Unable to run CPU trace profiling on a remote application

Post by rkanoong »

I have a .Net application running on a production 32-bit Window server. I need to attach YourKit profiler from my local machine to profile this application. As per the instructions on "Profiling remote Applications", I have registered the profiler agent ynpagent.dll and setup the environment variables COR_PROFILER and COR_ENABLE_PROFILING on remote production machine. Then, application is started on remote production machine and I run the profiler UI on my local machine and connect to remote application. The connection works ok and CPU profiling with sampling options works fine.

However, I need to do CPU tracing profiling to check for time spent in each method, invocation counts, hotspots etc. On starting CPU Tracing with appropriate filters set, I get error "CPU tracing has not been enabled for this application at startup".

What is required for enabling CPU Tracing for remote process? Can it be done without starting the process from Profiler UI ?

Thanks.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to run CPU trace profiling on a remote application

Post by Anton Katilin »

Hello,

At the remote machine, please set the following REG_DWORD registry key to 0:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\YNP_TRACING_DISABLED

If profiled application is running, it should be restarted to apply the change.

Best regards,
Anton
rkanoong
Posts: 3
Joined: Thu Feb 18, 2010 5:39 pm

Re: Unable to run CPU trace profiling on a remote application

Post by rkanoong »

Thanks Anton. It worked.

How can I enable Allocation recording for remote application.

Thanks.
rkanoong
Posts: 3
Joined: Thu Feb 18, 2010 5:39 pm

Re: Unable to run CPU trace profiling on a remote application

Post by rkanoong »

One more question:
I have the profiler agent ynpagent.dll registered, environment variables COR_PROFILER and COR_ENABLE_PROFILING set and registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\YNP_TRACING_DISABLED to 0 on remote production machine. Allocation recording is not enabled.

At this time, I am not connecting to the process from Profiler GUI. However, the performance of the application on production machine seems to have slowed since the above was done. Does the profiler agent impact the performance even when not connected to Profiler GUI? And, does it impact performance when attached to GUI in sampling mode? As per YourKit documentation, performance is impacted primarily in Tracing mode. Please clarify.

Thanks.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to run CPU trace profiling on a remote application

Post by Anton Katilin »

Hello,

Simply enabling tracing in a CLR process impacts performance, even when tracing is not running (when it is running, impact is bigger). This is a limitation of .NET framework which cannot turn its internal events for tracing support on demand. And this is why tracing is NOT enabled by default.

Sampling does not affect performance when it is not active. When it is active, its overhead is smaller that tracing's overhead.

So, do not enable tracing unless you really need it.

To reduce impact of tracing if you anyway need it, you can enable profiling in particular application(s) only, setting COR_PROFILER and COR_ENABLE_PROFILING via environment variables of the process instead of the registry.

Best regards,
Anton
Post Reply