Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

What’s New in dotTrace 2019.3

The 2019.3 release brings a lot of good news for dotTrace users, especially for those who want to profile their apps on macOS and Linux:

  • First of all, the dotTrace command-line profiler is available for both Linux and macOS.
  • Second, we’re adding support for .NET Core on these systems.
  • The third cool thing is about the Timeline Viewer: we’re introducing the flame graph to the call tree to make it easier to analyze.

Now, let’s proceed to the details!

.NET Core support on macOS and Linux

To profile .NET Core applications on macOS and Linux, you can use either JetBrains Rider or the command-line profiler (for more details see the next section). The profiling workflow is almost the same as for any other type of app, but there are some important notes:

  • Only the Sampling profiling type is supported.
  • Because of some limitations of .NET Core, there may be some issues with profiling projects that target .NET Core 3.0 or earlier. In some cases, the profiled application may hang or crash. Projects targeting .NET Core 3.1 can be profiled without any issues.

To profile a .NET Core 3.1 application in JetBrains Rider, simply select the Sampling profiling configuration and start the session as usual. But if you need to profile a project targeting .NET Core 3.0 or earlier, you should create a separate config. Follow these steps:

  1. Open the project you want to profile.
  2. Create a new profiling configuration:
    1. On the toolbar, in the list of profiling configurations, select Edit Configurations…
    2. In the opened Profiling Configurations window, click + Add profiling configuration to add a new profiling configuration.
    3. In the list, select Sampling (.NET Core 3.0 and earlier).
    4. Specify the configuration Name and the other profiling options.
      dotTrace. Support for .NET Core on macOS and Linux
    5. Click OK.
  3. To run profiling, select the newly created configuration on the toolbar, and click the profiling button.

Command-line profiler on macOS and Linux

The command-line profiler for Unix systems is distributed as .tar.gz and as a NuGet package. In terms of functionality, dotTrace.sh is almost equal to its Windows counterpart, ConsoleProfiler.exe. The only difference is some OS-specific dotTrace features. For example, as you already know from the previous section, we intentionally added a separate profiling option for .NET Core 3.0 and earlier versions. To profile such an app using the console profiler, you should specify the --support-earlier-net-core parameter:

./dotTrace.sh start --save-to=./snapshot.dtp --support-earlier-net-core MyApp.exe

Call tree as a flame graph

And here’s the cherry on top that’s waiting for you in dotTrace 2019.3: the flame chart in the Timeline Viewer (for the standalone dotTrace on Windows). The flame graph is a graphical representation of the Call Tree. Each call is shown as a horizontal bar whose length depends on the call’s total time, which equals the function’s own time + the time of all its child functions. The longer the call, the longer the bar.
To open the graph, click Flame graph in the Call Tree. This will build the graph for the current tree. Note that the graph is smart enough to hide functions that have zero (or close to zero) own time:

dotTrace. Flame graph in Timeline Viewer

The coolest thing about the flame graph is that you don’t need to thoroughly analyze the time of each call, as you immediately see it on the graph.

If you feel like trying any of these features right now, download and install ReSharper Ultimate, Rider, or the dotTrace command-line tools. If you have any questions, post a comment here and we’ll reply as best we can. Thanks!

image description