Visual studio 2012 profiling remotely debugged process

瘦欲@ 提交于 2019-11-28 23:28:02

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 profile

now 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!