llvm/llvm/lib/Support/Statistic.cpp

//===-- Statistic.cpp - Easy way to expose stats information --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the 'Statistic' class, which is designed to be an easy
// way to expose various success metrics from passes.  These statistics are
// printed at the end of a run, when the -stats command line option is enabled
// on the command line.
//
// This is useful for reporting information like the number of instructions
// simplified, optimized or removed by various transformations, like this:
//
// static Statistic NumInstEliminated("GCSE", "Number of instructions killed");
//
// Later, in the code: ++NumInstEliminated;
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/Statistic.h"

#include "DebugOptions.h"

#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstring>
usingnamespacellvm;

/// -stats - Command line option to cause transformations to emit stats about
/// what they did.
///
static bool EnableStats;
static bool StatsAsJSON;
static bool Enabled;
static bool PrintOnExit;

void llvm::initStatisticOptions() {}

namespace {
/// This class is used in a ManagedStatic so that it is created on demand (when
/// the first statistic is bumped) and destroyed only when llvm_shutdown is
/// called. We print statistics from the destructor.
/// This class is also used to look up statistic values from applications that
/// use LLVM.
class StatisticInfo {};
} // end anonymous namespace

static ManagedStatic<StatisticInfo> StatInfo;
static ManagedStatic<sys::SmartMutex<true> > StatLock;

/// RegisterStatistic - The first time a statistic is bumped, this method is
/// called.
void TrackingStatistic::RegisterStatistic() {}

StatisticInfo::StatisticInfo() {}

// Print information when destroyed, iff command line option is specified.
StatisticInfo::~StatisticInfo() {}

void llvm::EnableStatistics(bool DoPrintOnExit) {}

bool llvm::AreStatisticsEnabled() {}

void StatisticInfo::sort() {}

void StatisticInfo::reset() {}

void llvm::PrintStatistics(raw_ostream &OS) {}

void llvm::PrintStatisticsJSON(raw_ostream &OS) {}

void llvm::PrintStatistics() {}

std::vector<std::pair<StringRef, uint64_t>> llvm::GetStatistics() {}

void llvm::ResetStatistics() {}