llvm/llvm/lib/Support/Timer.cpp

//===-- Timer.cpp - Interval Timing Support -------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
/// \file Interval Timing implementation.
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/Timer.h"

#include "DebugOptions.h"

#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Config/config.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signposts.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include <limits>

#if HAVE_UNISTD_H
#include <unistd.h>
#endif

#ifdef HAVE_PROC_PID_RUSAGE
#include <libproc.h>
#endif

usingnamespacellvm;

// This ugly hack is brought to you courtesy of constructor/destructor ordering
// being unspecified by C++.  Basically the problem is that a Statistic object
// gets destroyed, which ends up calling 'GetLibSupportInfoOutputFile()'
// (below), which calls this function.  LibSupportInfoOutputFilename used to be
// a global variable, but sometimes it would get destroyed before the Statistic,
// causing havoc to ensue.  We "fix" this by creating the string the first time
// it is needed and never destroying it.
static ManagedStatic<std::string> LibSupportInfoOutputFilename;
static std::string &getLibSupportInfoOutputFilename() {}

static ManagedStatic<sys::SmartMutex<true> > TimerLock;

/// Allows llvm::Timer to emit signposts when supported.
static ManagedStatic<SignpostEmitter> Signposts;

namespace {
struct CreateTrackSpace {};
static ManagedStatic<cl::opt<bool>, CreateTrackSpace> TrackSpace;
struct CreateInfoOutputFilename {};
static ManagedStatic<cl::opt<std::string, true>, CreateInfoOutputFilename>
    InfoOutputFilename;
struct CreateSortTimers {};
ManagedStatic<cl::opt<bool>, CreateSortTimers> SortTimers;
} // namespace

void llvm::initTimerOptions() {}

std::unique_ptr<raw_fd_ostream> llvm::CreateInfoOutputFile() {}

namespace {
struct CreateDefaultTimerGroup {};
} // namespace
static ManagedStatic<TimerGroup, CreateDefaultTimerGroup> DefaultTimerGroup;
static TimerGroup *getDefaultTimerGroup() {}

//===----------------------------------------------------------------------===//
// Timer Implementation
//===----------------------------------------------------------------------===//

void Timer::init(StringRef TimerName, StringRef TimerDescription) {}

void Timer::init(StringRef TimerName, StringRef TimerDescription,
                 TimerGroup &tg) {}

Timer::~Timer() {}

static inline size_t getMemUsage() {}

static uint64_t getCurInstructionsExecuted() {}

TimeRecord TimeRecord::getCurrentTime(bool Start) {}

void Timer::startTimer() {}

void Timer::stopTimer() {}

void Timer::clear() {}

static void printVal(double Val, double Total, raw_ostream &OS) {}

void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {}


//===----------------------------------------------------------------------===//
//   NamedRegionTimer Implementation
//===----------------------------------------------------------------------===//

namespace {

Name2TimerMap;

class Name2PairMap {};

}

static ManagedStatic<Name2PairMap> NamedGroupedTimers;

NamedRegionTimer::NamedRegionTimer(StringRef Name, StringRef Description,
                                   StringRef GroupName,
                                   StringRef GroupDescription, bool Enabled)
  :{}

//===----------------------------------------------------------------------===//
//   TimerGroup Implementation
//===----------------------------------------------------------------------===//

/// This is the global list of TimerGroups, maintained by the TimerGroup
/// ctor/dtor and is protected by the TimerLock lock.
static TimerGroup *TimerGroupList =;

TimerGroup::TimerGroup(StringRef Name, StringRef Description)
  :{}

TimerGroup::TimerGroup(StringRef Name, StringRef Description,
                       const StringMap<TimeRecord> &Records)
    :{}

TimerGroup::~TimerGroup() {}


void TimerGroup::removeTimer(Timer &T) {}

void TimerGroup::addTimer(Timer &T) {}

void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {}

void TimerGroup::prepareToPrintList(bool ResetTime) {}

void TimerGroup::print(raw_ostream &OS, bool ResetAfterPrint) {}

void TimerGroup::clear() {}

void TimerGroup::printAll(raw_ostream &OS) {}

void TimerGroup::clearAll() {}

void TimerGroup::printJSONValue(raw_ostream &OS, const PrintRecord &R,
                                const char *suffix, double Value) {}

const char *TimerGroup::printJSONValues(raw_ostream &OS, const char *delim) {}

const char *TimerGroup::printAllJSONValues(raw_ostream &OS, const char *delim) {}

void TimerGroup::constructForStatistics() {}

std::unique_ptr<TimerGroup> TimerGroup::aquireDefaultGroup() {}