summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Timer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a ↵Alexandre Ganea2020-03-131-0/+4
| | | | | | | | | | | | compiler crash After a crash catched by the CrashRecoveryContext, this patch prevents from accessing dangling pointers in TimerGroup structures before the clang tool exits. Previously, the default TimerGroup had internal linked lists which were still pointing to old Timer or TimerGroup instances, which lived in stack frames released by the CrashRecoveryContext. Fixes PR45164. Differential Revision: https://reviews.llvm.org/D76099 (cherry picked from commit 28ad9fc20823678881baa0d723834b88ea9e8e3a)
* Timer - fix shadow variable warnings for Name/Description members. NFC.Simon Pilgrim2019-11-111-5/+6
|
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-4/+4
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [Legacy][TimePasses] allow -time-passes reporting into a custom streamFedor Sergeev2019-03-221-6/+11
| | | | | | | | | | | | | | | | As a followup to newpm -time-passes fix (D59366), now adding a similar functionality to legacy time-passes. Enhancing llvm::reportAndResetTimings to accept an optional stream for reporting output. By default it still reports into the stream created by CreateInfoOutputFile (-info-output-file). Also fixing to actually reset after printing as declared. Reviewed By: philip.pfaffe Differential Revision: https://reviews.llvm.org/D59416 llvm-svn: 356824
* Annotate timeline in Instruments with passes and other timed regions.Daniel Sanders2019-02-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instruments is a useful tool for finding performance issues in LLVM but it can be difficult to identify regions of interest on the timeline that we can use to filter the profiler or allocations instrument. Xcode 10 and the latest macOS/iOS/etc. added support for the os_signpost() API which allows us to annotate the timeline with information that's meaningful to LLVM. This patch causes timer start and end events to emit signposts. When used with -time-passes, this causes the passes to be annotated on the Instruments timeline. In addition to visually showing the duration of passes on the timeline, it also allows us to filter the profile and allocations instrument down to an individual pass allowing us to find the issues within that pass without being drowned out by the noise from other parts of the compiler. Using this in conjunction with the Time Profiler (in high frequency mode) and the Allocations instrument is how I found the SparseBitVector that should have been a BitVector and the DenseMap that could be replaced by a sorted vector a couple months ago. I added NamedRegionTimers to TableGen and used the resulting annotations to identify the slow portions of the Register Info Emitter. Some of these were placed according to educated guesses while others were placed according to hot functions from a previous profile. From there I filtered the profile to a slow portion and the aforementioned issues stood out in the profile. To use this feature enable LLVM_SUPPORT_XCODE_SIGNPOSTS in CMake and run the compiler under Instruments with -time-passes like so: instruments -t 'Time Profiler' bin/llc -time-passes -o - input.ll' Then open the resulting trace in Instruments. There was a talk at WWDC 2018 that explained the feature which can be found at https://developer.apple.com/videos/play/wwdc2018/405/ if you'd like to know more about it. Reviewers: bogner Reviewed By: bogner Subscribers: jdoerfert, mgorny, kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D52954 llvm-svn: 354365
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-271-1/+1
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* [Support] Add a public API to allow clearing all (static) timer groups.Graydon Hoare2018-08-171-2/+13
| | | | | | | | | | | | | | | | | | | | | | Summary: Formerly, all timer groups were automatically cleared when printed out. In https://reviews.llvm.org/rL324788 this behaviour was changed to not-clearing timers on printout, to allow printing timers more than once, but as a result clients (specifically Swift) that relied on the clear-on-print behaviour to inhibit duplicate timer printing on shutdown were broken. Rather than revert that change, this change adds a new API that enables clients that _want_ to clear all timers to do so explicitly. Reviewers: george.karpenkov, thegameg Reviewed By: george.karpenkov Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50874 llvm-svn: 339980
* [Timers] TimerGroup: add constructor from StringMap<TimeRecord>Roman Lebedev2018-05-161-0/+9
| | | | | | | | | | | | | | | | Summary: This is needed for the continuation of D46504, to be able to store the timings. Reviewers: george.karpenkov, NoQ, alexfh, sbenza Reviewed By: alexfh Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D46939 llvm-svn: 332506
* [Timers] TimerGroup: make printJSONValues() method publicRoman Lebedev2018-05-161-0/+2
| | | | | | | | | | | | | | | | Summary: This is needed for the continuation of D46504, to be able to store the timings. Reviewers: george.karpenkov, NoQ, alexfh, sbenza Reviewed By: alexfh Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D46938 llvm-svn: 332505
* [Timers] TimerGroup::printJSONValue(): print doubles with no precision lossRoman Lebedev2018-05-161-3/+7
| | | | | | | | | | | | | | | | Summary: Although this is not stricly required, i would very much prefer not to have known random precision losses along the way. Reviewers: george.karpenkov, NoQ, alexfh, sbenza Reviewed By: george.karpenkov Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D46937 llvm-svn: 332504
* [Timers] TimerGroup::printJSONValues(): print mem timer with .mem suffixRoman Lebedev2018-05-161-1/+1
| | | | | | | | | | | | | | Summary: We have just used `.sys` suffix for the previous timer, this is clearly a typo Reviewers: george.karpenkov, NoQ, alexfh, sbenza Reviewed By: alexfh Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D46936 llvm-svn: 332503
* [Support] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: chandlerc, jordan_rose, bkramer Reviewed By: bkramer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45140 llvm-svn: 329536
* Make LLVM timer reprintable: that is, make more than one print action on the ↵George Karpenkov2018-02-101-2/+10
| | | | | | | | | | | | | | | | same timer feasible Currently, each LLVM timer can be only printed once, as the act of printing clears the timer. Moreover, the current printing mechanism implicitly assumes that the timer is stopped -- and prints zero otherwise. This patch relaxes this assumption and makes printing statistics multiple time a possibility. Differential Revision: https://reviews.llvm.org/D43136 llvm-svn: 324788
* [YAML] Add support for non-printable charactersFrancis Visoiu Mistrih2017-12-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | LLVM IR function names which disable mangling start with '\01' (https://www.llvm.org/docs/LangRef.html#identifiers). When an identifier like "\01@abc@" gets dumped to MIR, it is quoted, but only with single quotes. http://www.yaml.org/spec/1.2/spec.html#id2770814: "The allowed character range explicitly excludes the C0 control block allowed), the surrogate block #xD800-#xDFFF, #xFFFE, and #xFFFF." http://www.yaml.org/spec/1.2/spec.html#id2776092: "All non-printable characters must be escaped. [...] Note that escape sequences are only interpreted in double-quoted scalars." This patch adds support for printing escaped non-printable characters between double quotes if needed. Should also fix PR31743. Differential Revision: https://reviews.llvm.org/D41290 llvm-svn: 320996
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [ManagedStatic] Avoid putting function pointers in template args.Benjamin Kramer2017-05-291-3/+5
| | | | | | | | This is super awkward, but GCC doesn't let us have template visible when an argument is an inline function and -fvisibility-inlines-hidden is used. llvm-svn: 304175
* Try to work around MSVC being buggy. Attempt #1.Benjamin Kramer2017-05-291-1/+3
| | | | | | error C2971: 'llvm::ManagedStatic': template parameter 'Creator': 'CreateDefaultTimerGroup': a variable with non-static storage duration cannot be used as a non-type argument llvm-svn: 304157
* [Timer] Move DefaultTimerGroup into a ManagedStatic.Benjamin Kramer2017-05-291-3/+4
| | | | | | | | | | | | | This used to be just leaked. r295370 made it use magic statics. This adds a global destructor, which is something we'd like to avoid. It also creates a weird situation where the mutex used by TimerGroup is re-created during global shutdown and leaked. Using a ManagedStatic here is also subtle as it relies on the mutex inside of ManagedStatic to be recursive. I've added a test for that in a previous change. llvm-svn: 304156
* Change default TimerGroup singleton to use magic staticsErich Keane2017-02-161-16/+3
| | | | | | | | | | | TimerGroup was showing up on a leak in valigrind, and used some pretty complex code to implement a singleton. This patch replaces the implementation with a vastly simpler one. Differential Revision: https://reviews.llvm.org/D28367 llvm-svn: 295370
* Statistic/Timer: Include timers in PrintStatisticsJSON().Matthias Braun2016-11-181-11/+51
| | | | | | Differential Revision: https://reviews.llvm.org/D25588 llvm-svn: 287370
* Timer: Track name and description.Matthias Braun2016-11-181-18/+23
| | | | | | | | | | | | | The previously used "names" are rather descriptions (they use multiple words and contain spaces), use short programming language identifier like strings for the "names" which should be used when exporting to machine parseable formats. Also removed a unused TimerGroup from Hexxagon. Differential Revision: https://reviews.llvm.org/D25583 llvm-svn: 287369
* Timer: Remove group-less NamedRegionTimer constructor.Matthias Braun2016-11-101-14/+0
| | | | | | | | | | | | | | | The NamedRegionTimer initializer without a group name puts the Timer into the "Misc" group and is (nearly) unused. Remove it. The only user of this constructor appears to be the HexagonGenInsert pass, which creates a counter without group to count the complete execution time of that pass, however since every pass gets a counter by the PassManager anyway this should be unnecessary. Also removed the pointless TimerGroup there. Differential Revision: https://reviews.llvm.org/D25582 llvm-svn: 286524
* Remove TimeValue usage from llvm/SupportPavel Labath2016-10-241-4/+6
| | | | | | | | | | | | | | | | | Summary: This is a follow-up to D25416. It removes all usages of TimeValue from llvm/Support library (except for the actual TimeValue declaration), and replaces them with appropriate usages of std::chrono. To facilitate this, I have added small utility functions for converting time points and durations into appropriate OS-specific types (FILETIME, struct timespec, ...). Reviewers: zturner, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25730 llvm-svn: 284966
* Timer: Fix doxygen comments, use member initializer; NFCMatthias Braun2016-10-141-16/+12
| | | | llvm-svn: 284181
* Test commit. Removes some spaces. No functionality changed.Alina Sbirlea2016-06-031-22/+22
| | | | | | | | | | | | Summary: Test commit. Removes some spaces. No functionality changed. Reviewers: llvm-commits Differential Revision: http://reviews.llvm.org/D20972 llvm-svn: 271711
* [Support] Allow multiple paired calls to {start,stop}Timer()Vedant Kumar2015-12-221-18/+14
| | | | | | | Differential Revision: http://reviews.llvm.org/D15619 Reviewed-by: rafael llvm-svn: 256258
* [Support] Timer: Use emplace_back() and range-based loops (NFC)Vedant Kumar2015-12-211-4/+4
| | | | llvm-svn: 256217
* [Support] Timer: simplify the init() methodVedant Kumar2015-12-211-5/+1
| | | | llvm-svn: 256215
* Simplify memory management with std::unique_ptr.Rafael Espindola2015-12-161-16/+12
| | | | llvm-svn: 255831
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-2/+2
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-2/+2
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-2/+0
| | | | | | NFC. llvm-svn: 232976
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* Kill the LLVM global lock.Zachary Turner2014-06-191-2/+2
| | | | | | | | | | | | | | This patch removes the LLVM global lock, and updates all existing users of the global lock to use their own mutex. None of the existing users of the global lock were protecting code that was mutually exclusive with any of the other users of the global lock, so its purpose was not being met. Reviewed by: rnk Differential Revision: http://reviews.llvm.org/D4142 llvm-svn: 211277
* Revert r211066, 211067, 211068, 211069, 211070.Zachary Turner2014-06-161-2/+3
| | | | | | | These were committed accidentally from the wrong branch before having a review sign-off. llvm-svn: 211072
* Kill the LLVM global lock.Zachary Turner2014-06-161-1/+1
| | | | llvm-svn: 211069
* Remove some more code out into a separate CL.Zachary Turner2014-06-161-1/+1
| | | | llvm-svn: 211067
* Users of the llvm global mutex must now acquire it manually.Zachary Turner2014-06-161-3/+2
| | | | | | This allows the mutex to be acquired in a guarded, RAII fashion. llvm-svn: 211066
* Revert "Remove support for runtime multi-threading."Zachary Turner2014-06-101-1/+2
| | | | | | This reverts revision r210600. llvm-svn: 210603
* Remove support for runtime multi-threading.Zachary Turner2014-06-101-2/+1
| | | | | | | | | | | | | | | | | | | | | This patch removes the functions llvm_start_multithreaded() and llvm_stop_multithreaded(), and changes llvm_is_multithreaded() to return a constant value based on the value of the compile-time definition LLVM_ENABLE_THREADS. Previously, it was possible to have compile-time support for threads on, and runtime support for threads off, in which case certain mutexes were not allocated or ever acquired. Now, if the build is created with threads enabled, mutexes are always acquired. A test before/after patch of compiling a very large TU showed no noticeable performance impact of this change. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D4076 llvm-svn: 210600
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-0/+1
| | | | | | necessary. llvm-svn: 207593
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-151-2/+2
| | | | | | instead of comparing to nullptr. llvm-svn: 206252
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-091-2/+2
| | | | | | to reduce verbosity. llvm-svn: 205829
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-8/+8
| | | | llvm-svn: 205697
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-1/+0
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* Revert "[C++11] Replace LLVM atomics with std::atomic."Benjamin Kramer2014-03-031-2/+2
| | | | | | | Breaks the MSVC build. DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list llvm-svn: 202731
* [C++11] Replace LLVM atomics with std::atomic.Benjamin Kramer2014-03-031-2/+2
| | | | | | | | | | | With C++11 we finally have a standardized way to specify atomic operations. Use them to replace the existing custom implemention. Sadly the translation is not entirely trivial as std::atomic allows more fine-grained control over the atomicity. I tried to preserve the old semantics as well as possible. Differential Revision: http://llvm-reviews.chandlerc.com/D2915 llvm-svn: 202730
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-2/+2
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
OpenPOWER on IntegriCloud