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 /llvm/lib/Support/Statistic.cpp | |
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
Diffstat (limited to 'llvm/lib/Support/Statistic.cpp')
-rw-r--r-- | llvm/lib/Support/Statistic.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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() { |