From: Milian Wolff Date: Fri, 11 Dec 2015 20:34:33 +0000 (+0100) Subject: Also make the number of sub traces of peaks configurable. X-Git-Tag: submit/tizen/20180620.112952^2~241 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9242914cef2c27c045ca37872721849a15a60ad;p=sdk%2Ftools%2Fheaptrack.git Also make the number of sub traces of peaks configurable. --- diff --git a/heaptrack_print.cpp b/heaptrack_print.cpp index a2e5899..d544ccd 100644 --- a/heaptrack_print.cpp +++ b/heaptrack_print.cpp @@ -274,21 +274,20 @@ struct Printer final : public AccumulatedTraceData sort(allocation.traces.begin(), allocation.traces.end(), sortOrder); size_t handled = 0; - const size_t subTracesToPrint = 5; - for (size_t j = 0; j < min(subTracesToPrint, allocation.traces.size()); ++j) { + for (size_t j = 0; j < min(subPeakLimit, allocation.traces.size()); ++j) { const auto& trace = allocation.traces[j]; sublabel(trace); handled += trace.*member; printBacktrace(trace.traceIndex, cout, 2, true); } - if (allocation.traces.size() > subTracesToPrint) { + if (allocation.traces.size() > subPeakLimit) { cout << " and "; if (member == &AllocationData::allocations) { cout << (allocation.*member - handled); } else { cout << formatBytes(allocation.*member - handled); } - cout << " from " << (allocation.traces.size() - subTracesToPrint) << " other places\n"; + cout << " from " << (allocation.traces.size() - subPeakLimit) << " other places\n"; } cout << '\n'; } @@ -467,6 +466,7 @@ struct Printer final : public AccumulatedTraceData string filterBtFunction; size_t peakLimit = 10; + size_t subPeakLimit = 5; }; } @@ -492,6 +492,8 @@ int main(int argc, char** argv) "Print top overall allocators, ignoring memory frees.") ("peak-limit,n", po::value()->default_value(10)->implicit_value(10), "Limit the number of reported peaks.") + ("sub-peak-limit,s", po::value()->default_value(5)->implicit_value(5), + "Limit the number of reported backtraces of merged peak locations.") ("print-histogram,H", po::value()->default_value(string()), "Path to output file where an allocation size histogram will be written to.") ("print-flamegraph,F", po::value()->default_value(string()), @@ -557,6 +559,7 @@ int main(int argc, char** argv) data.mergeBacktraces = vm["merge-backtraces"].as(); data.filterBtFunction = vm["filter-bt-function"].as(); data.peakLimit = vm["peak-limit"].as(); + data.subPeakLimit = vm["sub-peak-limit"].as(); const string printHistogram = vm["print-histogram"].as(); data.printHistogram = !printHistogram.empty(); const string printFlamegraph = vm["print-flamegraph"].as();