随机高CPU使用率

the*_*uru 2 visual-studio-code

我注意到,Visual Studio Code随机具有很高的CPU使用率。通常,这似乎与我拥有SQL Server项目的窗口有关。以下是code --status最近发生这种情况时的输出。对这里可能发生的事情有任何见解吗?

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
Run Code Online (Sandbox Code Playgroud)

Ray*_* Pk 7

首先你需要找到哪个进程占用了你的 CPU,因为 vscode 内置了进程资源管理器。您可以在 Help => Open Process Explorer 中找到

对我来说,罪魁祸首是electron_node tsserver.js,我通过打开typescript.disableAutomaticTypeAcquisition来解决它,为此你需要去设置=>扩展=>打字稿并检查 Typescript: disable Automatic Type Acquisition

  • 感谢您指向 **帮助 => 打开 Process Explorer** (7认同)

小智 5

我今天有同样的问题。

首先,我删除了Php intelliSese Extension,我的CPU使用率下降到25%左右。然后我删除了Vuejs的Vetur扩展(我不记得我是如何安装的,什么时候安装的),现在一切都正常运行。

希望它也对您有帮助。

  • PHP IntelliSese 没有看到太多的发展,我在 [PHP Intelephense](https://github.com/bmewburn/vscode-intelephense) 上运气更好。 (2认同)

Som*_*tha 5

Windows 10

我的 VS Code 也遇到了类似的问题。它消耗了大量的电量(高)和大量的 CPU 资源。对我来说,我正在运行一个 JavaScript 应用程序;所以我想,选择它后,Typescript: disable automatic type Acquisition它对我有用,并且有显着的改进!

即使您在使用 VS Code 时发现笔记本电脑异常发热,您也应该尝试这里其他人提到的方法之一!