clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
617 stars 100 forks source link

Clangd Trace #190

Open zrno opened 3 years ago

zrno commented 3 years ago

There is a setting in vs code for clangd: Trace. Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format.

I couldn't find any explanation about this. How do I trigger the generation of this file?

kadircet commented 3 years ago

You just set it to a file path you'd want clangd to output tracing info (note that clangd won't create a directory, but it will create the file, or overwrite it).

If that fails that's definitely a bug and I can't test it at the moment, but you can also try setting CLANGD_TRACE env variable while starting vscode. e.g: CLANGD_TRACE=/tmp/clangd_trace.json code /path/to/my/repo

zrno commented 3 years ago

when should the file be generated? Is it generated when I build a CMake target? Is it generated when I build using any compiler?

kadircet commented 3 years ago

hmm, i hope you are aware that we are talking about clangd and not clang here.

it will be created once you start your editing session (i.e. vscode starts clangd)

zrno commented 3 years ago

yep, I am aware it is clangd. I am trying to find out if I am doing something wrong because the file doesn't get generated.

HighCommander4 commented 3 years ago

I did try this locally on Linux, and the setting works fine for me.

If you're not able to get it to work, could you share:

zrno commented 3 years ago

image Note: Creating a file in that location manually from a terminal works.

Clangd server logs when I change the value of the settings and press enter: image

Extension version: 0.1.11 VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T16:45:26.313Z) OS version: Linux x64 5.12.9-arch1-1

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 3000)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 2| |Memory (System)|31.06GB (5.30GB free)| |Process Argv|--no-sandbox --unity-launch --crash-reporter-id 87fed376-385e-4b70-a6e7-f62fe0f386e3| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome| |XDG_SESSION_TYPE|wayland|
sam-mccall commented 3 years ago

The performance trace file option is unrelated to LSP's $/setTrace method.

Clangd server logs when I change the value of the settings and press enter:

Did you restart clangd after changing the setting? (e.g. with the "restart clangd" command, or just by restarting vscode)

zrno commented 3 years ago

I didn't restart at all. Just entered a new value and pressed enter. Should I restart?