-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excess CPU usage editing C file #28406
Comments
With all extensions disabled and no files open 'top' shows at minimum 1 core at 100% and up to three cores active: ''' PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND |
I have found that if code is allowed to run long enough (on the order of several minutes) the CPU load seems to go down. Opening a new file or reopening an existing file does not seem to provoke excess CPU usage. As such I would classify this as a low priority bug. |
To find out more about this issue, we need to get at the process that is causing the high load. VS Code creates multiple processes, each with different tasks. Depending on your OS you can get at the full command line of the process and paste it here. On Mac, the Activity Monitor allows to find the On Windows a tool like Process Explorer helps: Once you have the information please update this issue with it. Thanks! |
I have attached two text files. 'code.txt' is the result of 'ps -ef' filtered for the processes with the name '/usr/share/code/code' and 'Microsoft.VSCod' which capture the processes of which I am aware. (The latter seems to relate to the C/C++ extension as it does not appear if that extension is disabled.) 'top.txt' is the output of 'top' at about the same time and which shows the processes that are using 100% CPU. I'm using Linux and you explained how to collect the information for Windows and Mac OS. Does this provide the information you need? thanks, |
Yeah, two bad things happen here: FileWatcher going crazy and CPP tools going crazy. For the latter, please file a separate issue in their repo. Thanks |
I've filed an issue against cpptools.
|
@HankB is that a folder with lots of files you are opening? |
I don't think so: |
New useful information: I'm 'on the road' this morning and using a Toshiba chromebook converted to run Ubuntu 16.04. (H/W - Celeron N2840, 4GB RAM and running off a USB thumb drive.) Kernel is: This platform (opening files in a directory cloned from the project on the other laptop) does not exhibit the high CPU usage with either VS Code or the CPP extension (and running the same version of each.) It seems like there is something about the other PC that is provoking the problem. I would consider two possibilities:
Edit: There are differences in custom settings between the PCs and I will report those when I have access to both. (Both have minimap enabled and the problem PC has a custom dictionary which is now flagged as an error.) |
On another PC Desktop) with a faster I7, more RAM and RAIDed SSDs I do not experience the excessive CPU issue so I am leaning toward the first possible cause in the previous comment. Edit: Red Herring. CPU uisage on this third machine is high too. |
Does it still reproduce? |
I think so. Here is 'top' 5 minutes after opening a C file. (Before that I
had a markdown file open including the view and 'code' had settled to
minimal CPU usage.)
top - 12:47:12 up 2 days, 23:22, 1 user, load average: 1.75, 1.58, 1.27
Tasks: 342 total, 1 running, 341 sleeping, 0 stopped, 0 zombie
%Cpu(s): 13.7 us, 0.7 sy, 0.0 ni, 85.5 id, 0.1 wa, 0.0 hi, 0.0 si,
0.0 st
KiB Mem : 16351224 total, 192692 free, 10454872 used, 5703660 buff/cache
KiB Swap: 16777212 total, 16776752 free, 460 used. 4085064 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
22890 hbarta 20 0 1616560 445096 5796 S 100.0 2.7 5:10.78
Microsoft.VSCod
1804 hbarta 20 0 2271760 642528 160744 S 5.3 3.9 277:53.51 chrome
1889 hbarta 20 0 1034044 463504 272596 S 3.3 2.8 205:30.98 chrome
31746 hbarta 20 0 1459536 353888 64416 S 2.7 2.2 71:12.20 chrome
1491 hbarta 20 0 320164 70680 32300 S 1.0 0.4 52:21.18
Xwayland
...
Several minutes after closing the C file the 'Microsoft.VSCod' process is
still using 100% of a thread. I have found that if it is left along long
enough it will settle to normal CPU usage.
thanks,
hank
…On Wed, Nov 15, 2017 at 11:44 AM, Benjamin Pasero ***@***.***> wrote:
Does it still reproduce?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28406 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADLOfqCsiwSySVZpMpqIfT4vRjxKWaQWks5s2yMZgaJpZM4N1_ry>
.
--
'03 BMW F650CS - hers
'98 Dakar K12RS - "BABY K" grew up.
'93 R100R w/ Velorex 700 (MBD starts...)
'95 Miata - "OUR LC"
polish visor: apply squashed bugs, rinse, repeat
Beautiful Sunny Winfield, Illinois
|
I wonder if this issue is being caused by an installed extension. Can you try to run VS Code without extensions? From the command line (NOT the integrated terminal in Code), execute: |
Now updated to 1.18.1. Running with --disable-extension one thread starts
out at >100% and after several minutes settles to intermittently ~68% and
<10%. This is a significant improvement over the original complaint.
…On Sat, Nov 25, 2017 at 1:29 AM, Benjamin Pasero ***@***.***> wrote:
Closed #28406 <#28406>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28406 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADLOfqD0rUY_avDgGWyvYINhKi-hPhPDks5s58HIgaJpZM4N1_ry>
.
--
'03 BMW F650CS - hers
'98 Dakar K12RS - "BABY K" grew up.
'93 R100R w/ Velorex 700 (MBD starts...)
'95 Miata - "OUR LC"
polish visor: apply squashed bugs, rinse, repeat
Beautiful Sunny Winfield, Illinois
|
Linux yggdrasil 4.9.0-3-amd64 Open Source VS Code #1 SMP Debian 4.9.30-1 (2017-06-04) x86_64 GNU/Linux
Extensions
Steps to Reproduce:
1.Open code with no files.
2. Enter the following code and save as "hello.c"
#include <stdio.h>
int main(int argc, const char** argv)
'''
{
printf("Hello world\n");
}
'''
3. 'top' now shows:
'''
top - 22:06:28 up 36 min, 1 user, load average: 1.71, 1.84, 1.61
Tasks: 295 total, 2 running, 293 sleeping, 0 stopped, 0 zombie
%Cpu(s): 13.5 us, 1.6 sy, 0.9 ni, 83.4 id, 0.4 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 16351232 total, 5953836 free, 6084328 used, 4313068 buff/cache
KiB Swap: 16777212 total, 16777212 free, 0 used. 9294920 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5985 hbarta 20 0 1280180 457924 8128 S 93.8 2.8 10:41.90 Microsoft.VSCod
5954 hbarta 20 0 2136680 797576 34736 R 12.5 4.9 4:46.08 code
1303 hbarta 20 0 392312 87068 38956 S 6.2 0.5 0:41.46 Xorg
2117 hbarta 20 0 1549332 415720 157608 S 6.2 2.5 2:47.64 chrome
6342 hbarta 20 0 978204 173588 73288 S 6.2 1.1 0:12.55 chrome
1 root 20 0 139296 7108 5320 S 0.0 0.0 0:01.42 systemd
.
.
.
'''
4. Exit code. 'top' now shows
'''
top - 22:07:39 up 37 min, 1 user, load average: 1.71, 1.82, 1.62
Tasks: 290 total, 1 running, 289 sleeping, 0 stopped, 0 zombie
%Cpu(s): 13.3 us, 0.9 sy, 0.0 ni, 85.2 id, 0.4 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 16351232 total, 6651644 free, 5141652 used, 4557936 buff/cache
KiB Swap: 16777212 total, 16777212 free, 0 used. 10278940 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5985 hbarta 20 0 1280180 467888 8600 S 96.7 2.9 11:49.76 Microsoft.VSCod
2117 hbarta 20 0 1546260 417420 157568 S 3.3 2.6 2:50.20 chrome
2227 hbarta 20 0 953248 148904 77316 S 3.0 0.9 1:04.15 chrome
6342 hbarta 20 0 978204 174968 73284 S 3.0 1.1 0:14.87 chrome
2199 hbarta 20 0 764124 229220 134716 S 1.7 1.4 1:22.64 chrome
.
.
.
'''
Microsoft.VSCod
continues to execute for a couple minutes and finally exits.Possible duplicate of #28378
The text was updated successfully, but these errors were encountered: