microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

Code drawing about 100% CPU on iMac late 2015 MacOS 12.7.4 #12205

Closed Aclassifier closed 5 months ago

Aclassifier commented 5 months ago

Environment

Bug Summary and Steps to Reproduce

I have reported this at https://github.com/microsoft/vscode/issues/210378 , but there I was asked to promote it here instead. So I guess most details are there.

Type: Performance Issue I just run it. This might have happened recently.

I don't have Cpp code, but XC code (XMOS xTIMEcomposer). The directory I edit resides on a machine I have under the table, connected through the OS. That machine runs macOS 10.12.6 (just a compile only Mac mini from 2010).

Just now by sitting in this issue report window I notice the the fan is not hearable any more, still cpptools draws 98%.

Configuration and Logs

See https://github.com/microsoft/vscode/issues/210378

Other Extensions

No response

Additional context

No response

sean-mcmanus commented 5 months ago

@Aclassifier Are you using the C/C++ extension? If not, you can disable it for that workspace folder or globally. Otherwise, can you set C_Cpp.loggingLevel to "Debug" and see what is being reported in the C/C++ output window and/or the C/C++ language status indicator on the bottom right?

Aclassifier commented 5 months ago

Will I get langauge colouring without the C/C++ extension. XC is C plus realtime extension (par, timer, chan etc.), so the colouring scheme makes sense to me.

I have now set C_Cpp.loggingLevel to "Debug". Now, should I run it for a day or two and then, how do I fetch the log and submit it here?

sean-mcmanus commented 5 months ago

@Aclassifier VS Code implements lexical colorization for C/C++. Our extension has the potential to add semantic colorization on top of that, but it's unlikely to work if you're using a non-conforming language since it requires us to be able to parse the code fully. I'd try it out without our extension first.

With the loggingLevel set, you can just look and see what is actively being logged in the C/C++ pane of the Output window. You shouldn't need to wait that long for logging. The logging is just to inform you and us of what is causing the CPU usage.

image

The C/C++ language status is another potential source of information:

image

Another would be attaching a debugger to the cpptools process and looking for a thread that has call stack that is doing work, but there may be problems getting that to work on Mac (it's easier to get to work on Linux/Windows): https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv

Aclassifier commented 5 months ago

Thanks, no strange messages appeared so far. And the %CPU has relaxed a lot.