diff options
| author | Matthias Braun <matze@braunis.de> | 2016-09-27 19:38:55 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2016-09-27 19:38:55 +0000 |
| commit | 5391ffb671d16003d8efb0a65b4a8f156f9f02bc (patch) | |
| tree | 4f8276b7e345104bd36d89bd9b2a612061402852 | |
| parent | 63762b58c0122a2a7abd6a685fcccb60b9bb86b9 (diff) | |
| download | bcm5719-llvm-5391ffb671d16003d8efb0a65b4a8f156f9f02bc.tar.gz bcm5719-llvm-5391ffb671d16003d8efb0a65b4a8f156f9f02bc.zip | |
Statistic: Bring back printing on exit by default
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
| -rw-r--r-- | llvm/include/llvm/ADT/Statistic.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Support/Statistic.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h index c541383332e..0f797ec8de2 100644 --- a/llvm/include/llvm/ADT/Statistic.h +++ b/llvm/include/llvm/ADT/Statistic.h @@ -151,7 +151,7 @@ protected: static llvm::Statistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC, {0}, false} /// \brief Enable the collection and printing of statistics. -void EnableStatistics(); +void EnableStatistics(bool PrintOnExit = true); /// \brief Check if statistics are enabled. bool AreStatisticsEnabled(); diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index 774778143c2..d299bfcae46 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -45,6 +45,7 @@ static cl::opt<bool> StatsAsJSON("stats-json", cl::desc("Display statistics as json data")); static bool Enabled; +static bool PrintOnExit; namespace { /// StatisticInfo - This class is used in a ManagedStatic so that it is created @@ -91,12 +92,13 @@ void Statistic::RegisterStatistic() { // Print information when destroyed, iff command line option is specified. StatisticInfo::~StatisticInfo() { - if (::Stats) + if (::Stats || PrintOnExit) llvm::PrintStatistics(); } -void llvm::EnableStatistics() { +void llvm::EnableStatistics(bool PrintOnExit) { Enabled = true; + ::PrintOnExit = PrintOnExit; } bool llvm::AreStatisticsEnabled() { |

