Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random High CPU Usage

I have noticed that Visual Studio Code randomly has a really high CPU usage. Generally, this seems to be related to the window where I have a SQL server project. Below is the output from code --status when this recently happened. Any insights into what might be going on here?

code --status

Version:          Code 1.27.1 (5944e81f3c46a3938a82c701f96d7a59b074cfdc, 2018-09-06T09:14:32.385Z)
OS Version:       Darwin x64 17.7.0
CPUs:             Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2900)
Memory (System):  32.00GB (2.58GB free)
Load (avg):       3, 3, 3
VM:               0%
Screen Reader:    no
Process Argv:     /Users/thebitguru/Desktop/Work/Visual Studio Code/Visual Studio Code.app/Contents/MacOS/Electron
GPU Status:       2d_canvas:                    enabled
                  checker_imaging:              disabled_off
                  flash_3d:                     enabled
                  flash_stage3d:                enabled
                  flash_stage3d_baseline:       enabled
                  gpu_compositing:              enabled
                  multiple_raster_threads:      enabled_on
                  native_gpu_memory_buffers:    enabled
                  rasterization:                enabled
                  video_decode:                 enabled
                  video_encode:                 enabled
                  webgl:                        enabled
                  webgl2:                       enabled

CPU %   Mem MB     PID  Process
   87      131    4742  code main
    0      131    4743     gpu-process
    0      197    4744     window (~/golang/src/github.com/...PATH_MANUALLY_REMOVED.../auth.go — proj1)
    0       98    5023       extensionHost
    0       33    5024       watcherService
    0       33    5033       searchService
   77      262    4745     window (~/Desktop/...PATH_MANUALLY_REMOVED.../V20180905_4.0.18_1907.sql — db)
    0      131    5025       extensionHost
    0       98    5055         /Users/thebitguru/Desktop/Work/Visual Studio Code/code-portable-data/extensions/ms-mssql.mssql-1.4.0/sqltoolsservice/1.4.0/OSX/MicrosoftSqlToolsServiceLayer
    0       66    5026       watcherService
    0       33    5053       searchService
    0       98    5027     shared-process
    0      197    5121     window (~/Desktop/...PATH_MANUALLY_REMOVED.../messages.go — proj2)
    0       98    5122       extensionHost
    0       33    5123       watcherService
    0       33    5128       searchService
Workspace Stats:
|  Window (~/Desktop/...PATH_MANUALLY_REMOVED.../hermes.go — proj2)
|  Window (~/Desktop/...PATH_MANUALLY_REMOVED.../V20180905_4.0.18_1907.sql — db)
|  Window (~/golang/src/github.com/...PATH_MANUALLY_REMOVED.../auth.go — proj1)
|    Folder (proj2): 35 files
|      File types: go(23) log(2) yaml(2) gitignore(1) pid(1) md(1) mod(1)
|                  sum(1) txt(1) sql(1)
|      Conf files: makefile(1)
|    Folder (db): 175 files
|      File types: sql(154) conf(7) txt(3) jar(3) DS_Store(2) gitignore(1)
|                  md(1) yml(1) cmd(1) dll(1)
|      Conf files:
|    Folder (proj1): 3846 files
|      File types: go(3057) json(126) js(118) hcl(83) md(70) scss(54) s(50)
|                  gitignore(28) yml(27) txt(24)
|      Conf files: package.json(60) makefile(6) launch.json(1)
|                  settings.json(1) tsconfig.json(1)
|      Launch Configs: go
like image 572
thebitguru Avatar asked Sep 10 '18 04:09

thebitguru


People also ask

Why is my CPU usage so high out of nowhere?

You can expect high CPU utilization when playing some games, running a video-editing or streaming application, performing an antivirus scan, or juggling many browser tabs.

Why is my CPU usage at 70%?

It is normal for it to be high because the processor is not doing much at the moment. So, if your System Idle process is using 60% - 70% of your CPU, it means you're actually using 40% - 30% of it. No the System Idle Process is only using 20-30% when running no or very few programs.

Is it normal to have 90% CPU usage?

If you are currently not running any additional programs, your CPU usage should be anywhere between 1% and 10% just through Windows processes alone. Anything higher than that on an idle PC means that something might be wrong.

Is 100% CPU usage normal?

100% CPU usage is bad if you cannot cool down your CPU but don't worry if you can cool it down. 100% CPU usage for a long time means the program you use is super heavy and your CPU is not enough powerful to process it. Consider buying a faster CPU or closing the program.


2 Answers

first you need to find which process eating your cpu, for that vscode has inbuilt process Explorer. You can find at Help => Open Process Explorer

For me the culprit is electron_node tsserver.js, I solved it by turning on the typescript.disableAutomaticTypeAcquisition, for that you need to go Settings => Extensions => TypeScript and check the Typescript: disable Automatic Type Acquisition

like image 196
Rayees Pk Avatar answered Oct 10 '22 12:10

Rayees Pk


I had the same issue today.

First I removed Php intelliSese Extension and my cpu usage came down to around 25%. Then I removed Vetur extension for Vuejs (I don't remember how or when I installed this), and now everything is running normal and cool.

Hopefully it helps you too.

like image 27
ssbrar Avatar answered Oct 10 '22 12:10

ssbrar