问题
I have a native C++ project that uses COM to communicate with a separate project in VB.NET. I have been able to successfully profile the native project in the past by attaching the project to a separate exe that references the native dll. I'm now trying to profile the native project by connecting to dllhost.exe. This configuration works, since I'm able to debug through dllhost, but if I try and profile the code (or just attach the profiler to dllhost while I'm debugging), the profiler stops and I get the following output:
PRF0010: Launch Aborted - Unable to start vsperfmon.exe Error VSP1712: Invalid File: C:\...\MyProj110609.vsp PRF0025: No data was collected.
I know the profiler works since I can get results using a different configuration. I also know the debug configuration works. Any idea on what's going wrong?
回答1:
After some research, I found that the only way to do it with dllhost was to use the command line profiler. Go to the VS 2010 command prompt, and type in
VSPerfCmd /start:sample /output:c:\TestFile.vsp
VSPerfCmd /attach:[PID]
where c:\TestFile.vsp
is the name and path of the output file, and [PID]
is the profile ID of dllhost. Run whatever you want to profile, and when you're done, type in
VSPerfCmd /detach:[PID]
VSPerfCmd /shutdown
and you'll have your performance report.
来源:https://stackoverflow.com/questions/6298537/why-cant-i-profile-using-vsperfmon-by-attaching-to-dllhost-exe