A Step-by-Step Guide to Using dotTrace

Performance issues can quietly degrade even the best applications. If your .NET app feels slow or unresponsive, a profiler like dotTrace can help you pinpoint exactly where the problem lies. This guide walks you through using dotTrace step by step, even if you’re new to profiling.

A Step-by-Step Guide to Using dotTrace

Getting Started

JetBrains dotTrace is a powerful performance profiling tool developed by JetBrains for applications built on the .NET platform. It helps developers identify performance bottlenecks by analyzing how their application uses CPU time, threads, and function calls during execution. With features like sampling, tracing, and timeline profiling modes, dotTrace provides both high-level overviews and detailed insights into code behavior.

It integrates well with development environments such as Visual Studio, making it easier to diagnose slow methods, excessive resource usage, or threading issues. Overall, dotTrace is widely used to improve application efficiency, responsiveness, and scalability in .NET projects.

dotTrace guides developers through selecting the target application, choosing an appropriate profiling mode (such as sampling or timeline), and capturing snapshots during execution.

What is dotTrace?

JetBrains dotTrace is a performance profiling tool developed by JetBrains for .NET applications. It helps developers figure out why their application is slow or using too many resources.

What dotTrace does

dotTrace analyzes running .NET apps and shows things like:
  • Which methods/functions are taking the most time
  • Where CPU usage is high
  • How threads are behaving (useful for debugging concurrency issues)
  • Call stacks (who is calling what, and how often)

Key features of dotTrace

  • Performance profiling modes (sampling, tracing, timeline)
  • Timeline view to visualize CPU, threads, and async operations
  • Integration with Visual Studio
  • Works with apps built on frameworks like ASP.NET, WPF, WinForms, etc.

JetBrains dotTrace Use Case Example

If your web app built with ASP.NET is responding slowly, dotTrace can show:
  • Which function is causing the delay
  • Whether it's CPU-bound or waiting on I/O
  • How often that function is called

Step-by-step: Using dotTrace

These steps will help developers to observe how code behaves in real time, pinpoint slow methods or inefficient operations, and understand thread and CPU usage. It involves setting up the profiler, running or attaching it to a .NET application, and systematically analyzing performance data to identify bottlenecks.

Install and launch
  • Download dotTrace from JetBrains( click on the dottrace download link)
  • Install it (it often comes with JetBrains dotUltimate)
  • Open dotTrace

Choose how to profile
On launch, you’ll see options like:
  • Run → Start profiling a new application
  • Attach → Profile an already running process (useful for debugging live apps)
Note:- Beginners should start with Run

Select your application
You’ll configure what to profile:
  • Standalone app → Select your .exe
  • Web app (ASP.NET) → Choose IIS / IIS Express
  • Unit tests → Select test project
You can also:
  • Set working directory
  • Add command-line arguments

Choose a profiling mode
dotTrace profiler offers several modes:
  1. Sampling (recommended first)
    • Low overhead
    • Good overview of performance hotspots
  2. Tracing
    • Very detailed
    • Higher overhead (slower execution)
  3. Timeline
    • Best for async, UI, threading analysis
    • Shows CPU, threads, GC, etc.
Note:- Start with Sampling, then use Timeline if needed

Start profiling
Click Run
  • Your app will launch
  • dotTrace starts collecting data in the background

Reproduce the issue
While profiling:
  • Perform the action you want to analyze
  • e.g., click a slow button, load a page, run a feature)
Important: Only do the relevant actions to keep data clean

Take a snapshot
  • Click Get Snapshot when the scenario completes
  • dotTrace captures performance data
  • You can take multiple snapshots if needed

Analyze results
Key views:
  • Hotspots → Where most time is spent
  • Call Tree → Function call hierarchy
  • Timeline (if used) → CPU + thread activity

What to look for:
  • Methods with high execution time
  • Unexpected repeated calls
  • Blocking operations (I/O, locks)

Drill down into bottlenecks
Click any method to see:
  • Who called it
  • How often it runs
  • Time spent inside vs children
This helps identify root causes, not just symptoms

Optimize and repeat
  • Fix the issue in your code
  • Run dotTrace again
  • Compare snapshots to confirm improvement

Example scenario

Suppose your ASP.NET API is slow:
  1. Run with Sampling
  2. Hit the slow endpoint
  3. Take snapshot
  4. Check Hotspots
You might find:
  • A database call taking 70% time
  • Or a loop running too many times

Tips
  • Use Timeline mode for async/await issues
  • Filter out framework code to focus on your own
  • Save snapshots for later comparison
  • Combine with dotMemory for memory leaks

Summary

dotTrace is a powerful tool that turns guesswork into data-driven optimization. By following a structured profiling process(capture, analyze, optimize, and validate)you can significantly improve application performance.

Start simple, focus on major bottlenecks, and iterate. Over time, profiling will become a natural part of your development workflow.

Thanks

Kailash Chandra Behera

I am an IT professional with over 13 years of experience in the full software development life cycle for Windows, services, and web-based applications using Microsoft .NET technologies.

Previous Post Next Post

نموذج الاتصال