summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/TimeProfiler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[Support] Extend TimeProfiler to support multiple threads"Russell Gallop2019-12-241-81/+17
| | | | | | | and "[Support] Try to fix bot failure after 8ddcd1dc26" This reverts commits f70f180148 and 8ddcd1dc26 as this was breaking the MacOS build, which doesn't support thread_local.
* Revert "[Support] Fix time trace multi threaded support with ↵Russell Gallop2019-12-171-1/+2
| | | | | | | | | LLVM_ENABLE_THREADS=OFF" This reverts commit 2bbcf156acc157377e814fbb1828a9fe89367ea2. This was failing on systems which use __thread such as http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/30851
* [Support] Fix time trace multi threaded support with LLVM_ENABLE_THREADS=OFFRussell Gallop2019-12-171-2/+1
| | | | | | | Following on from 8ddcd1dc26ba, which added the support. As pointed out on D71059 this does not build on some systems with LLVM_ENABLE_THREADS=OFF. Differential Revision: https://reviews.llvm.org/D71548
* [Support] Try to fix bot failure after 8ddcd1dc26Russell Gallop2019-12-121-0/+1
| | | | http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41755
* [Support] Extend TimeProfiler to support multiple threadsRussell Gallop2019-12-121-17/+80
| | | | | | | | | | | | | | This makes TimeTraceProfilerInstance thread local. Added timeTraceProfilerFinishThread() which moves the thread local instance to a global vector of instances. timeTraceProfilerWrite() then writes recorded data from all instances. Threads are identified based on their thread ids. Totals are reported with artificial thread ids higher than the real ones. Replaced raw pointer for TimeTraceProfilerInstance with unique_ptr. Differential Revision: https://reviews.llvm.org/D71059
* [Support] Add TimeTraceScope constructor without detail argRussell Gallop2019-12-111-1/+3
| | | | | | | This simplifies code where no extra details are required Also don't write out detail when it is empty. Differential Revision: https://reviews.llvm.org/D71347
* [Support] Add ProcName to TimeTraceProfilerRussell Gallop2019-12-031-5/+9
| | | | | | | | | | This was hard-coded to "clang". This change allows it to to be used on processes other than clang (such as lld). This gets reported as clang-10 on Linux and clang.exe on Windows so adapted test to accommodate this. Differential Revision: https://reviews.llvm.org/D70950
* [NFC] Tidy-ups to TimeProfiler.cppRussell Gallop2019-12-031-10/+8
| | | | | | | | Remove unused include Make fields const where possible Move initialisation to initialiser list Differential Revision: https://reviews.llvm.org/D70904
* TimeTraceProfiler - fix uninitialized variable warning. NFCI.Simon Pilgrim2019-11-081-3/+3
|
* Fix time-trace breaking flame graph assumptionsRussell Gallop2019-09-051-12/+37
| | | | | | | | | | | | | | | | | | | -ftime-trace could break flame-graph assumptions on Windows, with an inner scope overrunning outer scopes. This was due to the way that times were truncated. Changed this so time_points for the flame-graph are truncated instead of durations, preserving the relative order of event starts and ends. I have tried to retain the extra precision for the totals, which count thousands or millions of events. Added assert to check this property holds in future. Fixes PR43043 Differential Revision: https://reviews.llvm.org/D66411 llvm-svn: 371039
* [Support][Time profiler] Make FE codegen blocks to be inside frontend blocksAnton Afanasyev2019-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: Add `Frontend` time trace entry to `HandleTranslationUnit()` function. Add test to check all codegen blocks are inside frontend blocks. Also, change `--time-trace-granularity` option a bit to make sure very small time blocks are outputed to json-file when using `--time-trace-granularity=0`. This fixes http://llvm.org/pr41969 Reviewers: russell.gallop, lebedev.ri, thakis Reviewed By: russell.gallop Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63325 llvm-svn: 369308
* [Support] Fix `-ftime-trace-granularity` optionAnton Afanasyev2019-07-241-7/+5
| | | | | | | | | | | | | | | | Summary: Move `-ftime-trace-granularity` option to frontend options. Without patch this option is showed up in the help for any tool that links libSupport. Reviewers: sammccall Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65202 llvm-svn: 366911
* [Support] Add JSON streaming output API, faster where the heavy value types ↵Sam McCall2019-04-251-35/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aren't needed. Summary: There's still a little bit of constant factor that could be trimmed (e.g. more overloads to avoid round-tripping primitives through json::Value). But this solves the memory scaling problem, and greatly improves the performance constant factor, and the API should leave room for optimization if needed. Adapt TimeProfiler to use it, eliminating almost all the performance regression from r358476. Performance test on my machine: perf stat -r 5 ~/llvmbuild-opt/bin/clang++ -w -S -ftime-trace -mllvm -time-trace-granularity=0 spirit.cpp Handcrafted JSON (HEAD=r358532 with r358476 reverted): 2480ms json::Value (HEAD): 2757ms (+11%) After this patch: 2520 ms (+1.6%) Reviewers: anton-afanasyev, lebedev.ri Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60804 llvm-svn: 359186
* Time profiler: optimize json output timeAnton Afanasyev2019-04-161-0/+5
| | | | | | | | | | | | | | | | | | Summary: Use llvm::json::Array.reserve() to optimize json output time. Here is motivation: https://reviews.llvm.org/D60609#1468941. In short: for the json array with ~32K entries, pushing back each entry takes ~4% of whole time compared to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%. Reviewers: lebedev.ri Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60792 llvm-svn: 358522
* Use native llvm JSON library for time profiler outputAnton Afanasyev2019-04-161-37/+37
| | | | | | | | | | | | | | Summary: Replace plain json text output with llvm JSON library wrapper using. Reviewers: takuto.ikuta, lebedev.ri Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60609 llvm-svn: 358476
* Time profiler: small fixes and optimizationsAnton Afanasyev2019-04-151-35/+43
| | | | | | | | | | | | | | Summary: Fixes from Roman's review here: https://reviews.llvm.org/D58675#1465336 Reviewers: lebedev.ri Subscribers: hiraditya, mgrang, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D60663 llvm-svn: 358448
* Improve hashing for time profilerAnton Afanasyev2019-04-091-16/+19
| | | | | | | | | | | | | | | | Summary: Use optimized hashing while writing time trace by join two hashes to one. Used for -ftime-trace option. Reviewers: rnk, takuto.ikuta Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60404 llvm-svn: 357998
* Adds `-ftime-trace` option to clang that produces Chrome `chrome://tracing` ↵Anton Afanasyev2019-03-301-0/+184
compatible JSON profiling output dumps. This change adds hierarchical "time trace" profiling blocks that can be visualized in Chrome, in a "flame chart" style. Each profiling block can have a "detail" string that for example indicates the file being processed, template name being instantiated, function being optimized etc. This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2 Patch by Aras Pranckevičius. Differential Revision: https://reviews.llvm.org/D58675 llvm-svn: 357340
OpenPOWER on IntegriCloud