aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Statistic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Statistic.cpp')
-rw-r--r--llvm/lib/Support/Statistic.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index 7747781..d299bfc 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() {