Getting Started With dotTrace On macOS And Linux
With the ReSharper tools 2023.1 Early Access Program (EAP) 5 release, we also made the standalone version of the dotTrace performance profiler available on macOS and Linux – for both x64 and ARM64 processors. You can now use dotTrace as a standalone tool to profile your .NET Core, Mono and Unity applications on all three major operating systems.
In this blog post, let’s look at how you can get started with dotTrace on macOS. Note that for Windows and Linux, the workflow will be similar.
Download dotTrace for your platform
To download dotTrace standalone, you can use the JetBrains Toolbox App. it provides convenient access to all of the JetBrains tools, and lets you install stable and early access versions side by side.
Alternatively, download the build for your OS by clicking on the appropriate link:
- dotTrace for macOS x64
- dotTrace for macOS ARM64
- dotTrace for Linux x64
- dotTrace for Linux ARM64
- dotTrace for Windows x64
- dotTrace for Windows ARM64
Choose what you want to profile, and how
After starting dotTrace, you will be greeted by the Home screen. Here, you will choose what to profile, and how to profile it. In addition, the home screen gives you access to earlier profiler snapshots, tutorials, and more. You can let dotTrace launch your application, or profile an already running process.
On the left-hand side of the Home screen, start by adding a run configuration. dotTrace on macOS and Linux lets you select a standalone desktop or console application to profile, as well as a .NET Core, Mono or Unity application. On Windows, you’ll be able to select several other application types, including IIS-hosted applications and Windows Services.
When profiling your own applications, don’t use Debug mode to build them. Ideally, use Release mode. The compiler optimizes call paths for you when your application is built in Release mode. It generally improves performance of your application by inlining methods and other techniques, and will give you more relevant results closer to the application you may be running in production.
After selecting the application type and finding the executable to profile, you’ll be able to select the profiling mode.
There are several other profiling modes you can select from: Timeline, Sampling, Tracing, and on Windows, Line-by-Line. Here’s a quick summary of what each mode does supports:
- Timeline and Sampling collect information about method execution times in your application. Timeline collects additional data about application events, distributed over time. This makes it easier to investigate UI freezes, garbage collection issues, thread starvation and so on. Generally, Timeline and Sampling have few overhead to your running application.
- Tracing and Line-by-Line collect information about the number of times a method in your application is called. Tracing does this at the method level, Line-by-Line (on Windows only) tracks call numbers at the statement level. Tracing and Line-by-Line will give you accurate call numbers, but due to the overhead they add, they are unreliable to measure call times.
Generally, your profiling workflow will start with Timeline profiling.
dotTrace lets you pick several other options as well, such as whether you want to profile child processes of your application, make use of the profiling API in your application to control when to capture snapshots from code, and more.
All set! You can now click Start, which will launch the profiler and the application you want to profile.
Controlling profiler snapshots
After you start dotTrace to profile an application, a profiler controller will be shown. The controller lets you start profiling, and decide when to capture a snapshot that you can investigate. You can see the CPU and memory usage of your application in a chart, which may be useful to identify a CPU spike after which you want to capture a snapshot.
When you’ve captured enough data, click Get Snapshot and Wait to save the snapshot and open it in the dotTrace viewer.
Analyzing a snapshot
The dotTrace viewer shows you information about what happened during your profiling session. On the left-hand side, you’ll see all types of events you can filter on. Center stage is the timeline of your profiling session, where you can zoom in on specific times. The right-hand side of the viewer shows you hotspots in code where a lot of time is spent, and a call tree of all methods.
Everything in the dotTrace viewer is a filter. If you zoom in on a period of time, all views will update to show data relevant to that time slice. If you select a specific method call to analyze, you will see the timeline highlights when that method is called, and events will be limited to events that occurred during that time frame.
Check out the dotTrace documentation to learn more about analyzing .NET profiler snapshots.
The ReSharper tools 2023.1 EAP 5 release added support for the standalone version of the dotTrace performance profiler on macOS and Linux – for both x64 and ARM64 processors. The profiling workflow is the same as on Windows: select the application to profile, pick a profiling mode, and capture and analyze a snapshot.
If you need to profile applications on a remote machine, you can use the dotTrace command-line profiler to capture a snapshot, and use the dotTrace viewer on your machine to analyze it, no matter if you are running Windows, macOS or Linux. And of course, you can profile your applications from within Visual Studio and directly from Rider as well.
Give the dotTrace Early Access Program (EAP) release on macOS or Linux a try, and let us know how it goes!
Subscribe to Blog updates
ReSharper 2024.1 EAP 7: Updates to C# and C++ Support
The ReSharper 2024.1 EAP 7 build has just been released and is ready for you to download! This build contains several improvements to C# and C++ support. Let’s take a look! C# support You will get suggestions to convert more code constructions in your source code to collection express…
Boost Code Quality with Qodana and GitHub Actions
It’s been roughly half a year since we introduced Qodana to .NET in our blog post about how to elevate your C# code quality with Qodana. Since then, we’ve been quite busy! Qodana went out of preview and into GA. Furthermore, we greatly improved the integration with our IDEs, providing an effortless …
Rider 2024.1 EAP 6: Updated New Project Dialog, Custom Naming Rules, and VCS Improvements
The latest installment in the Rider 2024.1 Early Access Program has just been released, and it’s jam-packed with updates. Before you download it, let’s take a look at the major changes. Updated New Project dialog To help reduce your cognitive load as you configure new projects, we have thor…
ReSharper 2024.1 EAP 6: The Most Feature-Rich Update Yet
The latest installment in the Early Access Program for ReSharper 2024.1 has just been released, and it's jam-packed with exciting updates. Let’s take a look at some of the highlights: Performance Faster Rename refactoring Renaming elements in your code is now faster and more efficient. T…