From 5a2e70a9cde99f6a065d78ad550ed386cdcc83f1 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Wed, 5 Aug 2020 13:20:36 +0200 Subject: New option allowing processing using multiple threads Introduces new option NUM_PROC_THREADS. It specifies the number threads doxygen is allowed to use during processing. When set to 0 doxygen will based this on the number of cores available in the system. You can set it explicitly to a value larger than 0 to get more control over the balance between CPU load and processing speed. At this moment only the input processing can be done using multiple threads. I plan to extend this with more parallel processing in the future. Since this is still an experimental feature the default is set to 1, which efficively disables parallel processing. Please report any issues you encounter that appear when changing the default. Note that generating dot graphs in parallel is still controlled separately by the DOT_NUM_THREADS setting. --- src/clangparser.cpp | 6 ------ src/commentscan.l | 12 ------------ src/config.xml | 15 +++++++++++++++ src/doxygen.cpp | 33 ++++++++++++++++----------------- src/doxygen.h | 10 ---------- src/message.cpp | 10 ---------- src/pre.l | 19 ------------------- src/util.cpp | 4 ---- 8 files changed, 31 insertions(+), 78 deletions(-) diff --git a/src/clangparser.cpp b/src/clangparser.cpp index d0ed573..5f1a021 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -20,22 +20,16 @@ #include "membername.h" #include "filename.h" #include "tooltip.h" -#if MULTITHREADED_INPUT #include #endif -#endif //-------------------------------------------------------------------------- -#if MULTITHREADED_INPUT std::mutex g_clangMutex; -#endif ClangParser *ClangParser::instance() { -#if MULTITHREADED_INPUT std::lock_guard lock(g_clangMutex); -#endif if (!s_instance) s_instance = new ClangParser; return s_instance; } diff --git a/src/commentscan.l b/src/commentscan.l index a1dd0e1..d695f0a 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -409,11 +409,9 @@ struct commentscanYY_state }; -#if MULTITHREADED_INPUT static std::mutex g_sectionMutex; static std::mutex g_formulaMutex; static std::mutex g_citeMutex; -#endif //----------------------------------------------------------------------------- @@ -2822,9 +2820,7 @@ static void addXRefItem(yyscan_t yyscanner, if (listName==0) return; //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append); -#if MULTITHREADED_INPUT std::unique_lock lock(g_sectionMutex); -#endif RefList *refList = RefListManager::instance().add(listName,listTitle,itemTitle); RefItem *item = 0; @@ -2898,9 +2894,7 @@ static void addXRefItem(yyscan_t yyscanner, // not already added. Returns the label of the formula. static QCString addFormula(yyscan_t yyscanner) { -#if MULTITHREADED_INPUT std::unique_lock lock(g_formulaMutex); -#endif struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; QCString formLabel; QCString fText=yyextra->formulaText.simplifyWhiteSpace(); @@ -2922,9 +2916,7 @@ static SectionType sectionLevelToType(int level) static void addSection(yyscan_t yyscanner) { -#if MULTITHREADED_INPUT std::unique_lock lock(g_sectionMutex); -#endif struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; SectionManager &sm = SectionManager::instance(); const SectionInfo *si = sm.find(yyextra->sectionLabel); @@ -2957,9 +2949,7 @@ static void addSection(yyscan_t yyscanner) static void addCite(yyscan_t yyscanner) { -#if MULTITHREADED_INPUT std::unique_lock lock(g_citeMutex); -#endif struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; QCString name=yytext; if (yytext[0] =='"') @@ -3127,9 +3117,7 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx) static void addAnchor(yyscan_t yyscanner,const char *anchor) { -#if MULTITHREADED_INPUT std::unique_lock lock(g_sectionMutex); -#endif struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; SectionManager &sm = SectionManager::instance(); const SectionInfo *si = sm.find(anchor); diff --git a/src/config.xml b/src/config.xml index 81610c0..29f4068 100644 --- a/src/config.xml +++ b/src/config.xml @@ -812,6 +812,21 @@ Go to the next section or return to the ]]> +