skip to Main Content

The other day I was using my laptop unplugged and it went from fully charged to 10% in 3 hours. Normally the battery would last all day. Long story short VS Code was obliterating my battery life. VS Code’s energy usage appears to be almost 30 times higher than Chrome, the #2 energy user. I’m not doing anything crazy – just some Shopify and Laravel templating – but I’m assuming it’s because of some of my extensions, not VS Code itself.

enter image description here

Does anyone know of a VS Code extension that shows CPU usage per extension? I looked around but didn’t find anything. Or is there some other way I can track down the culprit? I think CPU usage over a long period of time (like a few hours) would be more useful than current usage.

2

Answers


  1. Chosen as BEST ANSWER

    Found the culprit with htop. As pointed out in the comments, VS Code also has a Process Explorer that would've shown similar info. One nice thing about htop is that it shows CPU Time, which was helpful in finding processes with high CPU usage over a period of time.

    enter image description here


  2. VS Code has a process explorer, which you can open with the Developer: Open Process Explorer command in the command palette. You can find extension-related processes under the "extensionHost" tree item. Not every active extension will be shown there since this is just for extensions that run their own child processes, and it’s only showing those child processes. It’ll show CPU and memory usage.

    You can get similar information from using other system tools like an Activity Monitor / Process Manager tool, or htop.

    Note that VS Code is built on Chromium, so you can also use Chromium’s profiling tools. Open the devtools with the Developer: Toggle Developer Tools command in the command palette, and got the "Performance" tab, where you can capture performance traces. There’s also the overall "Performance monitor" view (open the devtools console and click the three dot menu to find it).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search