/** * Functions used for running pyright with pprof. * * Steps taken to get this to work: * - Install VC++ Desktop C++ workload with at least one Windows SDK - Git clone DataDog/pprof-nodejs: pprof support for Node.js (github.com) ○ Going to use this to generate an electron.node file for loading the profiler - Switch to packages\vscode-pylance - Npm install --save-dev node-abi@latest ○ this is so electron-rebuild can find the right ABI - Npm install --save-dev @electron/rebuild - Electron rebuild the git cloned datadog/pprof-nodejs based on the version in VS code ○ .\node_modules\.bin\electron-rebuild -v -m - Npm install --save-dev @datadog/pprof - Copy the build output from the electron-rebuild of the datadog git repository to the node_modules datadog ○ It should be named something like bin\win32-x64-110\pprof-nodejs.node ○ Copy it to the node_modules\@datadog\pprof\prebuilds\win32-x64 ○ Rename it to electron-110.node (or whatever ABI version it is using) - Modify pylance to use pprof around problem location using the pyright\packages\pyright-internal\pprof\profiler.ts ○ startProfile before ○ finishProfile after, passing it a file name - Rebuild Pylance - Make sure to turn off background analysis - Launch the CPU profiling profile - Reproduce the problem - Install Go (Get Started - The Go Programming Language) - Install Graphviz ○ Choco install graphviz - Install the pprof cli ○ go install github.com/google/pprof@latest - Run pprof -http to look at results. ○ Profile should be in same directory as vscode-pylance output. ○ Example pprof -http=: */ export declare function startProfile(): void; export declare function finishProfile(outputFile: string): void;