Skip to content

Runtime debugging

Robo edited this page Aug 14, 2025 · 2 revisions

Table of Contents

CPU profiling unresponsive window via tracing

When a window (renderer process) is unresponsive the devtools might be unable to collect the required cpu profile. A reliable way to profile in such cases is with the tracing infra using the steps below,

  • Restart VS Code with the following flags --trace --trace-category-filter="renderer,blink,v8,disabled-by-default-v8.cpu_profiler"
  • Once the unresponsive dialog pop ups, click on the Reopen button
  • In the new window, execute "F1 > Developer: Stop Tracing"

This will generate a trace json file which can be loaded into any of the following clients that supports the Google's Trace Event format

  1. chrome://tracing in any chromium browser
  2. ui.perfetto.dev
  3. Firefox profiler

Using samply on macOS

If you have an unsigned build of VSCode, then samply can be used to capture both JIT and native traces

  • Download the latest release of https://github.com/mstange/samply/releases
  • Start from the command line with following samply.exe record -s -o profile.json.gz --browsers -- <path>/Visual\ Studio\ Code.app/Contents/MacOS/Electron --js-flags="--perf-basic-prof --perf-prof-unwinding-info --interpreted-frames-native-stack"
  • Perform the steps for unresponsiveness or slow startups etc
  • Exit the application and the profile will be saved to profile.json.gz

You can inspect the profile with samply.exe load --breakpad-symbol-dir <path> profile.json.gz

Using etw on windows

  • Open Windows Performance Recorder from System start menu, it is not installed by default. You can install it via Windows Assessment and Deployment Kit (ADK) and choose Windows Performance Toolkit.
  • Select the following options under Resource Analysis
    1. CPU Usage
    2. File I/O activity
    3. Pool usage
    4. VirtualAlloc usage
  • Set Performance Scenario to General, Detail level to verbose and Logging mode to file
  • Start the recorder
  • Start the VSCode application from the terminal with the following additional flags --js-flags="--enable-etw-stack-walking --interpreted-frames-native-stack"
  • Perform the actions that trigger the issue (slow startups, out of memory, unresponsive threads etc)
  • Stop the recorder and save the file

The .etl file should not be attached to public issues since they contain PII and only shared via trusted channels.

Clone this wiki locally