mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
remove support for per-time peak memory tracking, this
isn't used by anyone and is better exposed as a non-per-timer thing. Also, stop including System/Mutex.h in Timer.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99841 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8e36a5c960
commit
fc86c3cfd6
@ -16,7 +16,6 @@
|
|||||||
#define LLVM_SUPPORT_TIMER_H
|
#define LLVM_SUPPORT_TIMER_H
|
||||||
|
|
||||||
#include "llvm/System/DataTypes.h"
|
#include "llvm/System/DataTypes.h"
|
||||||
#include "llvm/System/Mutex.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -39,8 +38,6 @@ class Timer {
|
|||||||
double UserTime; // User time elapsed
|
double UserTime; // User time elapsed
|
||||||
double SystemTime; // System time elapsed
|
double SystemTime; // System time elapsed
|
||||||
ssize_t MemUsed; // Memory allocated (in bytes)
|
ssize_t MemUsed; // Memory allocated (in bytes)
|
||||||
size_t PeakMem; // Peak memory used
|
|
||||||
size_t PeakMemBase; // Temporary for peak memory calculation.
|
|
||||||
std::string Name; // The name of this time variable.
|
std::string Name; // The name of this time variable.
|
||||||
bool Started; // Has this time variable ever been started?
|
bool Started; // Has this time variable ever been started?
|
||||||
TimerGroup *TG; // The TimerGroup this Timer is in.
|
TimerGroup *TG; // The TimerGroup this Timer is in.
|
||||||
@ -54,7 +51,6 @@ private:
|
|||||||
double getProcessTime() const { return UserTime+SystemTime; }
|
double getProcessTime() const { return UserTime+SystemTime; }
|
||||||
double getWallTime() const { return Elapsed; }
|
double getWallTime() const { return Elapsed; }
|
||||||
ssize_t getMemUsed() const { return MemUsed; }
|
ssize_t getMemUsed() const { return MemUsed; }
|
||||||
size_t getPeakMem() const { return PeakMem; }
|
|
||||||
public:
|
public:
|
||||||
std::string getName() const { return Name; }
|
std::string getName() const { return Name; }
|
||||||
|
|
||||||
@ -77,12 +73,6 @@ public:
|
|||||||
///
|
///
|
||||||
void stopTimer();
|
void stopTimer();
|
||||||
|
|
||||||
/// addPeakMemoryMeasurement - This method should be called whenever memory
|
|
||||||
/// usage needs to be checked. It adds a peak memory measurement to the
|
|
||||||
/// currently active timers, which will be printed when the timer group prints
|
|
||||||
///
|
|
||||||
static void addPeakMemoryMeasurement();
|
|
||||||
|
|
||||||
/// print - Print the current timer to standard error, and reset the "Started"
|
/// print - Print the current timer to standard error, and reset the "Started"
|
||||||
/// flag.
|
/// flag.
|
||||||
void print(const Timer &Total, raw_ostream &OS);
|
void print(const Timer &Total, raw_ostream &OS);
|
||||||
|
@ -11,15 +11,14 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Support/Debug.h"
|
|
||||||
#include "llvm/Support/Timer.h"
|
#include "llvm/Support/Timer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Support/Format.h"
|
#include "llvm/Support/Format.h"
|
||||||
|
#include "llvm/System/Mutex.h"
|
||||||
#include "llvm/System/Process.h"
|
#include "llvm/System/Process.h"
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -76,13 +75,13 @@ static TimerGroup *getDefaultTimerGroup() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
Timer::Timer(const std::string &N)
|
Timer::Timer(const std::string &N)
|
||||||
: Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), PeakMem(0), Name(N),
|
: Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), Name(N),
|
||||||
Started(false), TG(getDefaultTimerGroup()) {
|
Started(false), TG(getDefaultTimerGroup()) {
|
||||||
TG->addTimer();
|
TG->addTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer::Timer(const std::string &N, TimerGroup &tg)
|
Timer::Timer(const std::string &N, TimerGroup &tg)
|
||||||
: Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), PeakMem(0), Name(N),
|
: Elapsed(0), UserTime(0), SystemTime(0), MemUsed(0), Name(N),
|
||||||
Started(false), TG(&tg) {
|
Started(false), TG(&tg) {
|
||||||
TG->addTimer();
|
TG->addTimer();
|
||||||
}
|
}
|
||||||
@ -154,7 +153,6 @@ void Timer::startTimer() {
|
|||||||
UserTime -= TR.UserTime;
|
UserTime -= TR.UserTime;
|
||||||
SystemTime -= TR.SystemTime;
|
SystemTime -= TR.SystemTime;
|
||||||
MemUsed -= TR.MemUsed;
|
MemUsed -= TR.MemUsed;
|
||||||
PeakMemBase = TR.MemUsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::stopTimer() {
|
void Timer::stopTimer() {
|
||||||
@ -179,7 +177,6 @@ void Timer::sum(const Timer &T) {
|
|||||||
UserTime += T.UserTime;
|
UserTime += T.UserTime;
|
||||||
SystemTime += T.SystemTime;
|
SystemTime += T.SystemTime;
|
||||||
MemUsed += T.MemUsed;
|
MemUsed += T.MemUsed;
|
||||||
PeakMem += T.PeakMem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Timer &Timer::operator=(const Timer &T) {
|
const Timer &Timer::operator=(const Timer &T) {
|
||||||
@ -187,8 +184,6 @@ const Timer &Timer::operator=(const Timer &T) {
|
|||||||
UserTime = T.UserTime;
|
UserTime = T.UserTime;
|
||||||
SystemTime = T.SystemTime;
|
SystemTime = T.SystemTime;
|
||||||
MemUsed = T.MemUsed;
|
MemUsed = T.MemUsed;
|
||||||
PeakMem = T.PeakMem;
|
|
||||||
PeakMemBase = T.PeakMemBase;
|
|
||||||
Name = T.Name;
|
Name = T.Name;
|
||||||
Started = T.Started;
|
Started = T.Started;
|
||||||
assert(TG == T.TG && "Can only assign timers in the same TimerGroup!");
|
assert(TG == T.TG && "Can only assign timers in the same TimerGroup!");
|
||||||
@ -196,18 +191,6 @@ const Timer &Timer::operator=(const Timer &T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// addPeakMemoryMeasurement - This method should be called whenever memory
|
|
||||||
/// usage needs to be checked. It adds a peak memory measurement to the
|
|
||||||
/// currently active timers, which will be printed when the timer group prints
|
|
||||||
///
|
|
||||||
void Timer::addPeakMemoryMeasurement() {
|
|
||||||
size_t MemUsed = getMemUsage();
|
|
||||||
for (std::vector<Timer*>::iterator I = ActiveTimers->begin(),
|
|
||||||
E = ActiveTimers->end(); I != E; ++I)
|
|
||||||
(*I)->PeakMem = std::max((*I)->PeakMem, MemUsed-(*I)->PeakMemBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void printVal(double Val, double Total, raw_ostream &OS) {
|
static void printVal(double Val, double Total, raw_ostream &OS) {
|
||||||
if (Total < 1e-7) // Avoid dividing by zero.
|
if (Total < 1e-7) // Avoid dividing by zero.
|
||||||
OS << " ----- ";
|
OS << " ----- ";
|
||||||
@ -231,12 +214,6 @@ void Timer::print(const Timer &Total, raw_ostream &OS) {
|
|||||||
if (Total.MemUsed)
|
if (Total.MemUsed)
|
||||||
OS << format("%9lld", (long long)MemUsed) << " ";
|
OS << format("%9lld", (long long)MemUsed) << " ";
|
||||||
|
|
||||||
if (Total.PeakMem) {
|
|
||||||
if (PeakMem)
|
|
||||||
OS << format("%9lld", (long long)PeakMem) << " ";
|
|
||||||
else
|
|
||||||
OS << " ";
|
|
||||||
}
|
|
||||||
OS << Name << "\n";
|
OS << Name << "\n";
|
||||||
|
|
||||||
Started = false; // Once printed, don't print again
|
Started = false; // Once printed, don't print again
|
||||||
@ -364,8 +341,6 @@ void TimerGroup::removeTimer() {
|
|||||||
*OutStream << " ---Wall Time---";
|
*OutStream << " ---Wall Time---";
|
||||||
if (Total.getMemUsed())
|
if (Total.getMemUsed())
|
||||||
*OutStream << " ---Mem---";
|
*OutStream << " ---Mem---";
|
||||||
if (Total.getPeakMem())
|
|
||||||
*OutStream << " -PeakMem-";
|
|
||||||
*OutStream << " --- Name ---\n";
|
*OutStream << " --- Name ---\n";
|
||||||
|
|
||||||
// Loop through all of the timing data, printing it out.
|
// Loop through all of the timing data, printing it out.
|
||||||
|
Loading…
Reference in New Issue
Block a user