How to Use the typeperf Command to Collect Performance Data in Windows 11

The Need for Real-Time Performance Logging

If your Windows 11 computer randomly freezes for exactly three seconds every hour, troubleshooting the issue is incredibly difficult. You cannot sit and stare at the graphical Task Manager all day waiting for the freeze to happen. Even if you do, the Task Manager does not save historical data; once the spike passes, the evidence is gone.

To truly diagnose a transient bottleneck (like a sudden spike in CPU usage, or a temporary memory leak caused by a specific application), you need to log the system’s performance continuously in the background over several hours or days.

While you can use the graphical Performance Monitor (perfmon), setting up a long-term logging session through the GUI is tedious. Instead, you can use the typeperf command to instantly stream and record live performance data directly from the terminal.

Step 1: Open the Command Prompt

Because you are polling deep system metrics, it is highly recommended to run this command as an administrator to ensure you have access to all available data counters.

  1. Press the Windows Key, type cmd.
  2. Right-click on Command Prompt and select Run as administrator.

Step 2: Finding the Right Performance Counter

Windows tracks thousands of different performance metrics, called “counters.” Before you can record data, you must know the exact name of the counter you want to track.

To see a list of all available counters for the processor (CPU), you use the -q (query) flag.

typeperf -q "Processor"

This will output a list of specific metrics, such as \Processor(*)\% User Time and \Processor(*)\% Processor Time. The one you want for general CPU usage is \Processor(_Total)\% Processor Time.

Step 3: Streaming Live Data to the Terminal

To start monitoring the total CPU usage in real-time, simply type the command followed by the exact counter path in quotes.

typeperf "\Processor(_Total)\% Processor Time"

The terminal will instantly begin spitting out a new line of data every single second, showing the exact date, time, and the current CPU percentage (e.g., "08/22/2026 04:15:30","14.5367").

To stop the live stream, press Ctrl + C.

Step 4: Creating a Log File

Streaming data to the screen is not useful if you are walking away from the computer. You need to write that data to a file so you can analyze it tomorrow morning.

You can use the -f (format) flag to specify a CSV file, and the -o (output) flag to specify where to save the file.

typeperf "\Processor(_Total)\% Processor Time" -f CSV -o "%UserProfile%\Desktop\CPU_Log.csv"

This command will run silently in the background, writing a new line of data to the Excel file every single second until you manually stop it with Ctrl + C.

Step 5: Adjusting the Polling Interval

If you leave the script running overnight, taking a measurement every single second will generate a massive, unwieldy CSV file containing 30,000 rows of data. For long-term monitoring, it is better to take a sample every 60 seconds.

You can adjust the interval using the -si (sample interval) flag, followed by the number of seconds.

typeperf "\Processor(_Total)\% Processor Time" -si 60 -f CSV -o "%UserProfile%\Desktop\CPU_Log.csv"

When you come into the office the next morning, you can open the perfectly formatted CSV file in Microsoft Excel, instantly generate a line chart, and visually identify exactly what time the CPU spiked and caused the system freeze.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.