MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.72k stars 254 forks source link

how can I limit the cpu usage of ccls? #933

Closed cxwx closed 12 months ago

cxwx commented 1 year ago

Could I set the limit of the cpus in .ccls config file?

findNextStep commented 1 year ago

see https://github.com/MaskRay/ccls/blob/master/src/config.hh#L289

limit cpu core for ccls

cxwx commented 1 year ago

Thanks! It works. Is there any method to config it without compiling by oneself? So that I could use the homebrew version of ccls.

findNextStep commented 1 year ago

if you are using vscode, try "ccls.index.threads": <number>,

or you can add json into ccls launch arg --init, see https://github.com/MaskRay/ccls/blob/master/src/main.cc#L48

cxwx commented 12 months ago

if I use ale, they only support

call ale#Set('cpp_ccls_executable', 'ccls')
call ale#Set('cpp_ccls_init_options', {})
call ale#Set('c_build_dir', '')

call ale#linter#Define('cpp', {
\   'name': 'ccls',
\   'lsp': 'stdio',
\   'executable': {b -> ale#Var(b, 'cpp_ccls_executable')},
\   'command': '%e',
\   'project_root': function('ale#handlers#ccls#GetProjectRoot'),
\   'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')},
\})

Is there any way to set "ccls.index.threads" ? I don't find the correct way

if you are using vscode, try "ccls.index.threads": <number>,

or you can add json into ccls launch arg --init, see https://github.com/MaskRay/ccls/blob/master/src/main.cc#L48

what I need is a global way to set it I've try to set in cpp_ccls_init_options but it didn't work.

cxwx commented 12 months ago

not "ccls.index.threads": <number>, but cpp_ccls_init_options={'index':{'threads':1}}