summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Statistic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Statistic - Fix MSVC shadow warning against global PrintOnExit static ↵Simon Pilgrim2019-11-211-2/+2
| | | | variable. NFC.
* Fix builds where LLVM_ENABLE_STATS is disabledSimon Pilgrim2019-11-091-1/+1
| | | | Missed Stats->EnableStats rename in rG3fb832fe8bdc317687d5a4d2ca20f5f73b089341
* Statistic - Fix shadow variable warning. NFCI.Simon Pilgrim2019-11-091-4/+4
| | | | Rename option 'Stats' to 'EnableStats' and prevent clash with StatisticInfo::Stats member
* [Stats] Add ALWAYS_ENABLED_STATISTIC enabled regardless of LLVM_ENABLE_STATS.Volodymyr Sapsai2019-10-111-14/+13
| | | | | | | | | | | | | | | | | | | | | The intended usage is to measure relatively expensive operations. So the cost of the statistic is negligible compared to the cost of a measured operation and can be enabled all the time without impairing the compilation time. rdar://problem/55715134 Reviewers: dsanders, bogner, rtereshin Reviewed By: dsanders Subscribers: hiraditya, jkorous, dexonsmith, ributzka, cfe-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68252 llvm-svn: 374490
* Use llvm::stable_sortFangrui Song2019-04-231-2/+1
| | | | | | While touching the code, simplify if feasible. llvm-svn: 358996
* 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
* Fix lock order inversion between ManagedStatic and StatisticBob Haarman2018-04-171-2/+13
| | | | | | | | | | | | | | | | | | | | | Summary: Statistic and ManagedStatic both use mutexes. There was a lock order inversion where, during initialization, Statistic's mutex would be held while taking ManagedStatic's, and in llvm_shutdown, ManagedStatic's mutex would be held while taking Statistic's mutex. This change causes Statistic's initialization code to avoid holding its mutex while calling ManagedStatic's methods, avoiding the inversion. Reviewers: dsanders, rtereshin Reviewed By: dsanders Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45398 llvm-svn: 330236
* Support resetting STATISTIC() values using llvm::ResetStatistics()Daniel Sanders2018-03-081-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Most of the time, compiler statistics can be obtained using a process that performs a single compilation and terminates such as llc. However, this isn't always the case. JITs for example, perform multiple compilations over their lifetime and STATISTIC() will record cumulative values across all of them. Provide tools like this with the facilities needed to measure individual compilations by allowing them to reset the STATISTIC() values back to zero using llvm::ResetStatistics(). It's still the tools responsibility to ensure that they perform compilations in such a way that the results are meaningful to their intended use. Reviewers: qcolombet, rtereshin, bogner, aditya_nandakumar Reviewed By: bogner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44181 llvm-svn: 326981
* PrintStatistics() and PrintStatisticsJSON() should take StatLockDaniel Sanders2018-03-061-0/+2
| | | | | | | | | | | | | | | | | | These two functions iterate over the list of statistics but don't take the lock that protects the iterators from being invalidated by StatisticInfo::addStatistic(). So far, this hasn't been an issue since (in-tree at least) these functions are called by the StatisticInfo destructor so addStatistic() shouldn't be called anymore. However, we do expose them in the public API. Note that this only protects against iterator invalidation and does not protect against ordering issues caused by statistic updates that race with PrintStatistics()/PrintStatisticsJSON(). Thanks to Roman Tereshin for spotting it llvm-svn: 326834
* Re-commit: Make STATISTIC() values available programmaticallyDaniel Sanders2018-03-051-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It can be useful for tools to be able to retrieve the values of variables declared via STATISTIC() directly without having to emit them and parse them back. Use cases include: * Needing to report specific statistics to a test harness * Wanting to post-process statistics. For example, to produce a percentage of functions that were fully selected by GlobalISel Make this possible by adding llvm::GetStatistics() which returns an iterator_range that can be used to inspect the statistics that have been touched during execution. When statistics are disabled (NDEBUG and not LLVM_ENABLE_STATISTICS) this method will return an empty range. This patch doesn't address the effect of multiple compilations within the same process. In such situations, the statistics will be cumulative for all compilations up to the GetStatistics() call. Reviewers: qcolombet, rtereshin, aditya_nandakumar, bogner Reviewed By: rtereshin, bogner Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D43901 This re-commit fixes a missing include of <vector> which it seems clang didn't mind but G++ and MSVC objected to. It seems that, clang was ok with std::vector only being forward declared at the point of use since it was fully defined eventually but G++/MSVC both rejected it at the point of use. llvm-svn: 326738
* Revert r326723: Make STATISTIC() values available programmaticallyDaniel Sanders2018-03-051-25/+5
| | | | | | Despite building cleanly on my machine in three separate configs, it's failing on pretty much all bots due to missing includes among other things. Investigating. llvm-svn: 326726
* Make STATISTIC() values available programmaticallyDaniel Sanders2018-03-051-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It can be useful for tools to be able to retrieve the values of variables declared via STATISTIC() directly without having to emit them and parse them back. Use cases include: * Needing to report specific statistics to a test harness * Wanting to post-process statistics. For example, to produce a percentage of functions that were fully selected by GlobalISel Make this possible by adding llvm::GetStatistics() which returns an iterator_range that can be used to inspect the statistics that have been touched during execution. When statistics are disabled (NDEBUG and not LLVM_ENABLE_STATISTICS) this method will return an empty range. This patch doesn't address the effect of multiple compilations within the same process. In such situations, the statistics will be cumulative for all compilations up to the GetStatistics() call. Reviewers: qcolombet, rtereshin, aditya_nandakumar, bogner Reviewed By: rtereshin, bogner Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D43901 llvm-svn: 326723
* [ADT] Replace sys::MemoryFence with standard atomics.Benjamin Kramer2018-02-011-6/+2
| | | | | | | | This is a bit faster in theory, in practice it's cold code that's only active in !NDEBUG, so it probably doesn't make a difference. This is one of the last users of our homegrown Atomic.h. llvm-svn: 323999
* [YAML] Add support for non-printable charactersFrancis Visoiu Mistrih2017-12-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Mark all library options as hidden.Zachary Turner2017-12-011-4/+6
| | | | | | | | | | | | | | | | | These command line options are not intended for public use, and often don't even make sense in the context of a particular tool anyway. About 90% of them are already hidden, but when people add new options they forget to hide them, so if you were to make a brand new tool today, link against one of LLVM's libraries, and run tool -help you would get a bunch of junk that doesn't make sense for the tool you're writing. This patch hides these options. The real solution is to not have libraries defining command line options, but that's a much larger effort and not something I'm prepared to take on. Differential Revision: https://reviews.llvm.org/D40674 llvm-svn: 319505
* 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
* Statistic/Timer: Include timers in PrintStatisticsJSON().Matthias Braun2016-11-181-16/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D25588 llvm-svn: 287370
* Statistic: Bring back printing on exit by defaultMatthias Braun2016-09-271-2/+4
| | | | | | | | Turns out several external projects relied on llvm printing statistics on exit. Let's go back to this behaviour by default and have an optional parameter to disable it. llvm-svn: 282532
* Statistic: Only print statistics on exit for -statsMatthias Braun2016-09-261-8/+9
| | | | | | | | | | | | | | | Previously enabling the statistics with EnableStatistics() would lead to them getting printed to stderr/-info-output-file on exit. However frontends may want a way to enable statistics and do the printing on their own instead of the forced printing on exit. This changes the code so that only the -stats option enables printing on exit, EnableStatistics() only enables the tracking but requires invoking one of the PrintStatistics() variants. Differential Revision: https://reviews.llvm.org/D24819 llvm-svn: 282425
* Statistic: Add machine parseable json outputMatthias Braun2016-06-151-14/+60
| | | | | | | | | | | | - We lacked a short unique identifier for a statistics, so I renamed the current "Name" field that just contained the DEBUG_TYPE name of the current file to DebugType and added a new "Name" field that contains the C++ identifier of the statistic variable. - Add the -stats-json option which outputs statistics in json format. Differential Revision: http://reviews.llvm.org/D20995 llvm-svn: 272826
* Simplify memory management with std::unique_ptr.Rafael Espindola2015-12-161-11/+6
| | | | llvm-svn: 255831
* Support: Clean up TSan annotations.Peter Collingbourne2015-08-181-0/+1
| | | | | | | | | | | Remove support for Valgrind-based TSan, which hasn't been maintained for a few years. We now use the TSan annotations only if LLVM is compiled with -fsanitize=thread. We no longer need the weak function definitions as we are guaranteed that our program is linked directly with the TSan runtime. Differential Revision: http://reviews.llvm.org/D12121 llvm-svn: 245374
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | 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
* Revert "[C++11] Replace LLVM atomics with std::atomic."Benjamin Kramer2014-03-031-1/+1
| | | | | | | 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-1/+1
| | | | | | | | | | | 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
* Now that we have C++11, turn simple functors into lambdas and remove a ton ↵Benjamin Kramer2014-03-011-15/+8
| | | | | | | | of boilerplate. No intended functionality change. llvm-svn: 202588
* Disable statistics on Release builds and move tests that depend on -stats.Jan Wen Voung2013-03-081-1/+17
| | | | | | | | | | | | | | | | | Summary: Statistics are still available in Release+Asserts (any +Asserts builds), and stats can also be turned on with LLVM_ENABLE_STATS. Move some of the FastISel stats that were moved under DEBUG() back out of DEBUG(), since stats are disabled across the board now. Many tests depend on grepping "-stats" output. Move those into a orig_dir/Stats/. so that they can be marked as unsupported when building without statistics. Differential Revision: http://llvm-reviews.chandlerc.com/D486 llvm-svn: 176733
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-2/+2
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-271-1/+1
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 llvm-svn: 164768
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-271-1/+1
| | | | llvm-svn: 164767
* Silence tsan false-positives (tsan can't track things which are only safe due toNick Lewycky2011-12-051-0/+3
| | | | | | | memory fences) in statistics registration, which works the same way that ManagedStatic registration does. llvm-svn: 145869
* Let printf do the formatting instead aligning strings ourselves.Benjamin Kramer2011-10-161-7/+6
| | | | | | While at it, merge some format strings. llvm-svn: 142140
* Support: Add llvm::AreStatisticsEnabled().Daniel Dunbar2011-02-261-0/+4
| | | | llvm-svn: 126558
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120298
* remove trailing whitespaceJim Grosbach2010-08-171-7/+7
| | | | llvm-svn: 111254
* Introduce namespace-scope functions to enable LLVM statistics withoutDouglas Gregor2010-03-301-21/+37
| | | | | | | passing the command-line parameter "-stats" and to print the resulting statistics without calling llvm_shutdown(). llvm-svn: 99893
* rename GetLibSupportInfoOutputFile -> CreateInfoOutputFile andChris Lattner2010-03-301-6/+5
| | | | | | have it always return a new stream to simplify clients. llvm-svn: 99874
* if a timergroup is destroyed before its timers, print times.Chris Lattner2010-03-301-1/+1
| | | | llvm-svn: 99873
* Change errs() to dbgs().David Greene2010-01-051-1/+2
| | | | llvm-svn: 92642
* Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutexTorok Edwin2009-09-271-2/+2
| | | | | | in RegisterStatistic. llvm-svn: 82896
* remove some uses of llvm/Support/Streams.hChris Lattner2009-08-231-6/+6
| | | | llvm-svn: 79842
* Have scoped mutexes take referenes instead of pointers.Owen Anderson2009-07-071-1/+1
| | | | llvm-svn: 74931
* Use atomic operations when accessing statistics, and make the lazy ↵Owen Anderson2009-06-231-4/+8
| | | | | | initialization of statistics actually threadsafe. llvm-svn: 74005
* Guard the statistics table.Owen Anderson2009-06-221-1/+3
| | | | llvm-svn: 73916
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-0/+4
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Fix more -Wshorten-64-to-32 warnings.Evan Cheng2008-05-051-2/+2
| | | | llvm-svn: 50659
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-0/+1
| | | | | | annoying warnings. llvm-svn: 47367
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* eliminate constructor from Statistic class. It is now impossible to get aChris Lattner2006-12-191-4/+4
| | | | | | static constructor for them :). Transition complete. llvm-svn: 32710
OpenPOWER on IntegriCloud