views:

124

answers:

4

Hi, I am interested in a profiler that is capable of attaching to a .NET Windows Service that starts on windows startup. I have tried dotTrace, YourKit and AutomatedQA profilers without luck. All of them show the windows service as shaded and so I cannot profile my service. Can someone suggest a working profiler?

+1  A: 

MemProfiler support to attach a process and profile services as well. Also you can actually import windows crash dumps which might be useful if you are getting out of memory exceptions.

Another way to this would be calling profiler's API from the code. (Assuming your profiler support that)

dr. evil
+1  A: 

dot trace has an api for profiling. Your best be might be to call the api from your code. The EAP version (dot trace 4.0) seems to let me choose a running service, but I'm not sure if it is starting a new instance or not.

Mike Two
A: 

Can you run the Windows service under Visual Studio or some IDE with a Pause button? If so, then this technique will tell what it is doing and where you can fruitfully optimize it. (It works in any environment, not just Linux.)

Mike Dunlavey
A: 

See my suggestion as to how you can add a -foreground switch to a service to make it easier to run it as a regular program, which makes it easier to profile and debug. Or alternatively, add some code in the startup of your service to do some busy waiting until some condition is satisfied (eg a file exists, or registry value is set), which should give you as much time as you need to attach the profiler.

the_mandrill