다음을 통해 공유


Performance Analysis on .NET Core applications with PerfView (on Windows)

Back in July, the .NET Runtime Team shipped the first official version of .NET Core.    .NET Core is a stand-alone down version of the .NET Runtime that is Open Source (it lives in the .NET Core GitHub Repo) and cross platform (runs on Windows, OSX and a variety of Linux distributions).     Version 5 of ASP NET Web framework uses .NET runs on .NET Core (as well as the Desktop .NET Framework), and allows those web services to be run on Linux if desired.    You can also build 'console' applications that can do all sorts of tasks.   The links above describe how to actually build things with this new framework.

Once you have done this, inevitably,  you will want to do performance analysis on your .NET Core app, and as you would expect, PerfView can help you there.

Generally speaking, PerfView should 'just work' with .NET Core (on Windows), and the investigation the normal documentation works just as you would expect.      In  particular you can use PerfView to collect CPU samples and you should be able to see all your code displayed symbolically as you would expect.     Pretty much any investigation on .NET Core works like it would if you were running on the .NET Desktop framework.

There is a slight caveat in the short term however:

If  you want to look inside the .NET Core framework, and see the symbolic names of .NET Framework code, that also works fine (it looks the necessary symbolic information up on standard Microsoft symbol servers) IF you are NOT using pre-release versions of the code.

For the next few months, however (10/2016 through 3/2017) if you go to the .NET Core Site for getting started on windows  https://www.microsoft.com/net/core#windows, you will find it probably DOES point you at prelease code.    What his means is that you may not get symbolic information for .NET Framework code.

If you need to see these methods, there is a work-around.

  1. Open an Administrative command prompt
  2. Start PerfView with the command  'PerfView /ForceNGENRundown /BufferSizeMB=256

And use that to collect the data.   What this does is force the Runtime to dump symbolic information (NGEN Rundown) for managed code instead of trying to look up that data using Microsoft's symbol servers.    This allows PerfView to display symbols for ANY managed code you use (including the framework) and works around this problem.

UPDATE 10/2017.   IF you are profiling .NET Core please get at least version 1.9.65 of PerfView.   

The current version of PerfView on the download page is 1.9.0 which is reasonably old (over a year) and is missing some fixes that are useful for the .NET Core case.    In particular fixes to simply 'get framework symbols' are not present.      We are working on getting the Download page updated, but it may take a while because the way we sign packages has changed since V1.9.0 was release.

While the instructions above are still accurate and useful as a work-around, it is strongly recommended that until we get the download page updated, if you are using PerfView for .NET Core applications that you go to the  Github releases page and download the 1.9.65 or later version.