explaingit

microsoft/perfview

4,677C#Audience · developerComplexity · 3/5Setup · easy

TLDR

A free Windows tool from Microsoft that records CPU and memory activity in a running .NET application so you can find exactly what is making it slow or memory-hungry.

Mindmap

mindmap
  root((PerfView))
    What it does
      CPU profiling
      Memory analysis
      ETW event collection
    Platforms
      Windows runtime
      Linux trace import
      dotNET Core
    Key Library
      TraceEvent
      ETW events
      Custom tooling
    Audience
      dotNET developers
      Performance engineers
      ASP.NET teams
    Setup
      Single exe download
      No install needed
      Visual Studio for build
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Profile a slow ASP.NET or C# application to find which functions consume the most CPU time.

USE CASE 2

Diagnose memory leaks by recording a heap snapshot and seeing which objects are accumulating.

USE CASE 3

Build custom performance analysis tools using the TraceEvent library to process ETW or .NET Core trace data.

USE CASE 4

Collect performance traces from a Linux .NET Core service and analyze them on a Windows machine.

Tech stack

C#.NETETWTraceEvent

Getting it running

Difficulty · easy Time to first run · 30min

Download a single .exe and run it, no installation required, but reading the built-in Help guide first takes about 30 minutes.

No license terms are stated in the explanation.

In plain English

PerfView is a free tool from Microsoft for diagnosing slow or memory-hungry Windows applications. You point it at a running program, it records what the CPU and memory are doing, and then it shows you where time and memory are being spent so you can figure out what to fix. It runs on Windows and can also read performance data collected from Linux machines. The tool is especially useful for programs built on the .NET platform, which is Microsoft's framework for building Windows applications and services. If you have heard of C# or ASP.NET, those run on .NET. PerfView has deep knowledge of how .NET programs work internally, which lets it give more detailed and accurate results than generic profilers. Under the hood, PerfView is built on a library called TraceEvent. That library knows how to collect and read low-level Windows event data (called ETW, Event Tracing for Windows) as well as the tracing format used by newer .NET Core applications. If you are a developer who wants to write your own tools to process that kind of data, you can use the TraceEvent library directly without using the PerfView interface at all. Using PerfView does not require building it from source. You download a single .exe file, run it, and the full user guide is built into the application under the Help menu. Video tutorials are available for people who prefer to learn by watching. If something goes wrong or you have a question, you can file an issue on the project's GitHub page and attach the recorded trace file so others can reproduce your exact situation. Building PerfView from source requires Visual Studio 2022 with a few specific components installed, all of which are available in the free Community Edition. The README describes exactly which components to select during installation.

Copy-paste prompts

Prompt 1
I'm using PerfView to profile a slow ASP.NET application. Walk me through collecting a CPU trace and identifying the top bottleneck functions.
Prompt 2
Show me a minimal C# example using the TraceEvent library to subscribe to .NET GC events and print them to the console.
Prompt 3
I recorded a PerfView memory trace. How do I navigate the GC Heap analysis view to find which object types are accumulating the most memory?
Prompt 4
Write a PowerShell script that launches PerfView to collect a 30-second CPU trace of a named process and saves it to a timestamped .etl file.
Prompt 5
What are the most important PerfView views for diagnosing an ASP.NET request that is taking 2 seconds but should take 50ms?
Open on GitHub → Explain another repo

← microsoft on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.