Skip to content
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 #822

Closed
HankB opened this issue Jun 13, 2017 · 11 comments
Closed

excess CPU usage #822

HankB opened this issue Jun 13, 2017 · 11 comments

Comments

@HankB
Copy link

HankB commented Jun 13, 2017

VS Code 1.13.0
Linux Debian 9 (4.9.0-3-amd64 #1 SMP Debian 4.9.30-1 (2017-06-04) x86_64 GNU/Linux)
C/C++ 0.11.4
(Other extensions installed and presently disabled.)

Open VS code and CPU shows 100% on one or two threads including /home/hbarta/.vscode/extensions/ms-vscode.cpptools-0.11.4/bin/Microsoft.VSCode.CPP.Extension.linux. After several minutes the CPU load decreases to what would be expected as normal. If VS code is exited and restarted the same problem occurs.

To provoke the problem, it is only necessary to open a C file (Hello world will do) in VS code. No other actions are required.

A bug is also filed against VS code itself for excess CPU usage (microsoft/vscode#28406)

@bobbrow
Copy link
Member

bobbrow commented Jun 13, 2017

Thank you for reporting the issue. The 100% you are seeing should only be for a single core and it is temporary while the extension is parsing your workspace folder and sub-folders. There is currently a bug in the extension where much of this processing is being repeated unnecessarily on subsequent relaunches, but we have a fix in the pipeline to address that.

@HankB
Copy link
Author

HankB commented Jun 14, 2017

It consumes one core for about 24 minutes.
It must be doing a lot of parsing. This is on a laptop with an I7 processor and SATA SSD.
Due to the use of CPPunit test framework it references headers outside the directory tree. Is that causing a problem?
By comparison, a project builds and runs test cases in 2 seconds:
hbarta@yggdrasil:/Documents/C/c-txtutil/cpputest-starter-project$ make clean
Making clean
hbarta@yggdrasil:
/Documents/C/c-txtutil/cpputest-starter-project$ time make
compiling io_CppUMockTest.cpp
compiling io_CppUMock.cpp
compiling example-explodingfakes.c
compiling AllTests.cpp
compiling ExampleTest.cpp
compiling TestDump.cpp
compiling TestLog.cpp
compiling MyFirstTest.cpp
compiling io.c
compiling dump.c
compiling logmsg.c
compiling Example.c
Building archive test-lib/libexample.a
a - test-obj/example-platform/io.o
a - test-obj/../dump.o
a - test-obj/../logmsg.o
a - test-obj/example-src/Example.o
Linking example_tests
Running example_tests
.........
OK (9 tests, 9 ran, 297 checks, 0 ignored, 0 filtered out, 1 ms)

real 0m2.003s
user 0m1.572s
sys 0m0.192s

Project can be cloned from https://github.com/HankB/c-txtutil if you wish to test with the code that provokes the issue.

@HankB
Copy link
Author

HankB commented Jun 14, 2017

I have just found that the same version of VS code and CPP extension does not exhibit excessive CPU usage in a resource constrained environment. Please see microsoft/vscode#28406 (comment) for additional details. (If you prefer, I will copy the entire comment here.)

@HankB
Copy link
Author

HankB commented Jun 14, 2017

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 (on the other issue. e.g. some residue in a file where VS code saves state that is causing a problem.)

Edit: Red herring - CPU usage on this other PC is high as well.

@bobbrow
Copy link
Member

bobbrow commented Jun 29, 2017

I cloned your repo and edited the text, and I don't see any excessive CPU usage. The folder parses in about a second for me on Windows and on Mint 18.1. My machines have non-RAID'ed SSDs and are otherwise average.

I think I have all the sources you've referenced in your post. Does this include path look about right? It doesn't resolve all of the headers in all of your test folders, but it should be pulling in the most important ones. I tried using both the "Tag Parser" and "Default" intelliSenseEngines

            "includePath": [
                "${workspaceRoot}",
                "${workspaceRoot}/../cpputest/include",
                <system includes omitted for brevity>,

            "browse": {
                "path": [
                    "${workspaceRoot}/../cpputest/include",
                    <system includes omitted for brevity>,

I'm not sure what else might be going on with your machine, but I'm not seeing anything awry with the C++ extension. :/

@HankB
Copy link
Author

HankB commented Jun 30, 2017

Hi Bob,
Thank you for trying to duplicate the problem.
I haven't bothered to set the paths inside Code since I build from the command line but what you have looks correct. Perhaps that is something I should sort out.
I think the next thing would be for me to try to debug it on my system. It looks like there is sufficient information in the project documentation to get me started.

thanks,
hank

@bobbrow
Copy link
Member

bobbrow commented Jul 6, 2017

Let us know if you need any further help. I'm going to close this issue for now since it doesn't look like there is anything else I can help you with at the moment.

@bobbrow bobbrow closed this as completed Jul 6, 2017
@ogrisel
Copy link

ogrisel commented Nov 17, 2017

I think I have a similar issue:

VS Code 1.18.0
Ubuntu 16.04
C/C++ 0.14.2

To reproduce, just clone https://github.com/python/cpython , open vscode in the top level folder of the repo and open a .c file in a tab, e.g.: Modules/_pickle.c.

I get a process named Microsoft.VSCode.CPP.IntelliSense.Msvc.linux running 100% CPU seemingly forever (and I have to kill it manually when I close the vscode window).

@ogrisel
Copy link

ogrisel commented Nov 17, 2017

I deleted all my user settings and the .vscode folder in my project to get the default configuration of vscode and the c/c++ extension and I still get the 100% CPU usage issue whenever I edit a file like cpython/Modules/_pickle.c in vscode under Linux.

@bobbrow
Copy link
Member

bobbrow commented Nov 17, 2017

@ogrisel, can you please create a new issue for your case and we will gladly look into it? Your issue looks different than @HankB's issue.

@ogrisel
Copy link

ogrisel commented Nov 29, 2017

@bobbrow done here: #1294

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants