diff --git a/src/analyze/gui/parser.cpp b/src/analyze/gui/parser.cpp --- a/src/analyze/gui/parser.cpp +++ b/src/analyze/gui/parser.cpp @@ -300,7 +300,7 @@ } } -std::pair mergeAllocations(const ParserData& data) +std::pair mergeAllocations(Parser *parser, const ParserData& data) { CallerCalleeResults callerCalleeResults; TreeData topRows; @@ -316,6 +316,9 @@ addCallerCalleeEvent(location, cost, &symbolRecursionGuard, &callerCalleeResults); return &it->children; }; + const auto allocationCount = data.allocations.size(); + const auto onePercent = qMax(1, allocationCount / 100); + auto progress = 0; // merge allocations, leave parent pointers invalid (their location may change) for (const auto& allocation : data.allocations) { auto traceIndex = allocation.traceIndex; @@ -341,6 +344,11 @@ break; } } + ++progress; + if ((progress % onePercent) == 0) { + const int percent = progress * 100 / allocationCount; + emit parser->progressMessageAvailable(i18n("merging allocations... %1%", percent)); + } } // now set the parents, the data is constant from here on setParents(topRows, nullptr); @@ -589,7 +597,7 @@ emit progressMessageAvailable(i18n("merging allocations...")); // merge allocations before modifying the data again - const auto mergedAllocations = mergeAllocations(*data); + const auto mergedAllocations = mergeAllocations(this, *data); emit bottomUpDataAvailable(mergedAllocations.first); // also calculate the size histogram