Is it possible to profile remotely debugged process?
I have tried using tips from article on remote debugging with VS 2012
which don't help as, when launching profiler, it asks for paths to dll and exe debugged: these paths are not treated as paths on the remote machine even though you apply remote debugging settings(as in the article).
You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, select Debug > Attach to Process or press Ctrl+Alt+p in Visual Studio, and use the Attach to Process dialog to attach the debugger to the process.
Open the Performance Profiler by choosing Debug > Performance Profiler (or Alt + F2). For more information on using the CPU Usage or Memory usage tool in the Performance Profiler vs. the debugger-integrated tools, see Run profiling tools with or without the debugger.
05 On the General settings panel, under Debugging, select Off next to Remote debugging setting to disable remote debugging using Microsoft Visual Studio for the selected Azure App Services web application. Click Save to apply the changes.
Unfortunately, that's not possible (at least as I understood by lot of research) directly from Visual Studio IDE and the only possible way for now is using stand-alone profiler.
NOTE: the following applies to Visual Studio 2013, but might be a guideline for older distributions.
Stand-alone profiler let's you profile an application straight from production machine without the need to install all development framework.
This stand-alone profiler is shipped with Visual Studio and there can be found its setup file. I found it in the following folder:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\Setups\
I found two files: vs_profiler_x64_enu.exe
and vs_profiler_x86_enu.exe
. I picked the first one, but depends on the destination machine's architecture. Take this file to the destination machine and install it.
Now, on the destination machine, you have to launch the application to profile by the utility VCPrefCmd.exe
located in the folder:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools
through command line. So you can add the above path in the environment or just type the following:
"c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\VSPerfCmd.exe" /start:sample /output:"c:\report.vsp" /launch:"c:\pathTo\appToProfile.exe"
where:
/start
is the profiling mode, "sampling" in this case/output
pathname of the report to produce/launch
your application to profilenow your application will start automatically and you'll do all your work.
Once you are done, close your profiling application and type the following command to the previous command line:
"c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\VSPerfCmd.exe" /shutdown
and this will stop the profiling and produce your report.vsp
(or whatever you called it) file with all the data.
Now take this produced file to your development machine and provide it to your Visual Studio (open or drag'n'drop) and you'll have your application profile.
While looking forward to complete embedding of "Remote debugging and profiling" in Visual Studio, this procedure might be fair enough.
Just want to add to this very good answer, that the tools for Visual Studio 2017 are in the following folder:
C:\Program Files (x86)\Microsoft Visual Studio 15.0\Team Tools\Performance Tools\x64
the setup files are in:
c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Team Tools\Performance Tools\Setups\
The command for attaching to a running ASP.net application is:
VSPerfCmd.exe /attach:4716 /Crosssession /start:sample /output:report.vsp <br/>
In my case, this did not work on an older windows 7 machine.
But the following one did:
C:\Program Files (x86)\Microsoft Visual Studio 15.0\Team Tools\Performance Tools
VSPerf.exe /attach:4711 /file:report.vspx
VSPerf.exe /status
VSPerf.exe /stop
The resulting VSPX file can then be opened with Visual Studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With