mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 21:58:08 +00:00
Automatically compute a good value for number of indexer threads to start.
This commit is contained in:
parent
145bf87d70
commit
16dc2971a6
@ -1673,8 +1673,11 @@ void QueryDbMain(IndexerConfig* config) {
|
|||||||
FileConsumer::SharedState file_consumer_shared;
|
FileConsumer::SharedState file_consumer_shared;
|
||||||
|
|
||||||
// Start indexer threads.
|
// Start indexer threads.
|
||||||
std::cerr << "[querydb] Starting " << config->indexerCount << " indexers" << std::endl;
|
int indexerCount = std::min<int>(std::thread::hardware_concurrency(), 2) - 1;
|
||||||
for (int i = 0; i < config->indexerCount; ++i) {
|
if (config->indexerCount > 0)
|
||||||
|
indexerCount = config->indexerCount;
|
||||||
|
std::cerr << "[querydb] Starting " << indexerCount << " indexers" << std::endl;
|
||||||
|
for (int i = 0; i < indexerCount; ++i) {
|
||||||
new std::thread([&]() {
|
new std::thread([&]() {
|
||||||
IndexMain(config, &file_consumer_shared, &project, &queue_do_index, &queue_do_id_map, &queue_on_id_mapped, &queue_on_indexed);
|
IndexMain(config, &file_consumer_shared, &project, &queue_do_index, &queue_do_id_map, &queue_on_id_mapped, &queue_on_indexed);
|
||||||
});
|
});
|
||||||
|
@ -59,9 +59,14 @@ struct IndexerConfig {
|
|||||||
std::string cacheDirectory;
|
std::string cacheDirectory;
|
||||||
NonElidedVector<std::string> whitelist;
|
NonElidedVector<std::string> whitelist;
|
||||||
NonElidedVector<std::string> blacklist;
|
NonElidedVector<std::string> blacklist;
|
||||||
int indexerCount = 1;
|
|
||||||
int maxWorkspaceSearchResults = 1000;
|
|
||||||
std::vector<std::string> extraClangArguments;
|
std::vector<std::string> extraClangArguments;
|
||||||
|
|
||||||
|
// Maximum workspace search results.
|
||||||
|
int maxWorkspaceSearchResults = 1000;
|
||||||
|
|
||||||
|
// Force a certain number of indexer threads. If less than 1 a default value
|
||||||
|
// should be used.
|
||||||
|
int indexerCount = 0;
|
||||||
// If false, the indexer will be disabled.
|
// If false, the indexer will be disabled.
|
||||||
bool enableIndexing = true;
|
bool enableIndexing = true;
|
||||||
// If false, indexed files will not be written to disk.
|
// If false, indexed files will not be written to disk.
|
||||||
@ -72,9 +77,10 @@ struct IndexerConfig {
|
|||||||
MAKE_REFLECT_STRUCT(IndexerConfig,
|
MAKE_REFLECT_STRUCT(IndexerConfig,
|
||||||
cacheDirectory,
|
cacheDirectory,
|
||||||
whitelist, blacklist,
|
whitelist, blacklist,
|
||||||
indexerCount,
|
|
||||||
maxWorkspaceSearchResults,
|
|
||||||
extraClangArguments,
|
extraClangArguments,
|
||||||
|
|
||||||
|
maxWorkspaceSearchResults,
|
||||||
|
indexerCount,
|
||||||
enableIndexing, enableCacheWrite, enableCacheRead);
|
enableIndexing, enableCacheWrite, enableCacheRead);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user