How to get Performance or Coverage profiling data for a Windows Service using DPS 7.X
First, make sure that your service is allowed to interactive with desktop
(from the Service properties page, check 'Allow service interactive with desktop'').
For Windows Service written in unmanaged code:
.Instrument the service with Performance Analysis or Coverage Analysis
.Register the service
* Please note: During the registration, if you see a session control window for regsvr32.exe, just ignore it (them).
.Start the service
When you start the instrumented service, you should see the performance or coverage session control window for your service.
For Windows service written in managed code (assuming that the service is build and registered):
If the service is hosted by SVCHOST.exe, please set the following environment variables under system or user account:
For Performance Analysis profiling:
For Coverage Analysis:
Then reboot your machine to take effects. You can find out the above environment variables in AnalysisCommonEnv.bat file:
[Root]:\Program Files\Compuware\DevPartner Performance and Coverage\Analysis\AnalysisCommonEnv.bat
If the service is not hosted by SVCHOST.exe, there is no need to reboot the machine. Or you can either run the AnalysisCommonEnv.bat file from the command line to set the above environment variables then start the service from the same command line. Remember to add /Coverage when you run AnalysisCommonEnv.bat file for Coverage Analysis profiling.
When the service starts, you should get a session control for the service which will allow you to take snapshots.
Please remove these environment variables after you've done profiling. Otherwise, Performance /Coverage Analysis will profile any running .NET application.