aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-29 05:21:16 +0000
committerChris Lattner <sabre@nondot.org>2005-01-29 05:21:16 +0000
commit6cfbd626806875214291d44ea4f9064cc1479623 (patch)
tree616b26288cb31439946673e6291cc78f80408569
parent03aef68dc1768e78ca536cffbb8bd52332968042 (diff)
downloadexternal_llvm-6cfbd626806875214291d44ea4f9064cc1479623.tar.gz
external_llvm-6cfbd626806875214291d44ea4f9064cc1479623.tar.bz2
external_llvm-6cfbd626806875214291d44ea4f9064cc1479623.zip
Memory used is a delta between memuse at the start of the time and the
memuse at the end, thus it is signed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19904 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/Timer.h4
-rw-r--r--lib/Support/Timer.cpp5
2 files changed, 4 insertions, 5 deletions
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h
index 86194d16b6..3af688c863 100644
--- a/include/llvm/Support/Timer.h
+++ b/include/llvm/Support/Timer.h
@@ -36,7 +36,7 @@ class Timer {
double Elapsed; // Wall clock time elapsed in seconds
double UserTime; // User time elapsed
double SystemTime; // System time elapsed
- size_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 calculation...
std::string Name; // The name of this time variable
@@ -50,7 +50,7 @@ public:
double getProcessTime() const { return UserTime+SystemTime; }
double getWallTime() const { return Elapsed; }
- size_t getMemUsed() const { return MemUsed; }
+ ssize_t getMemUsed() const { return MemUsed; }
size_t getPeakMem() const { return PeakMem; }
std::string getName() const { return Name; }
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index bea81648ef..3713f7f69c 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -19,7 +19,6 @@
#include <functional>
#include <iostream>
#include <map>
-
using namespace llvm;
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
@@ -101,7 +100,7 @@ static inline size_t getMemUsage() {
struct TimeRecord {
double Elapsed, UserTime, SystemTime;
- size_t MemUsed;
+ ssize_t MemUsed;
};
static TimeRecord getTimeRecord(bool Start) {
@@ -111,7 +110,7 @@ static TimeRecord getTimeRecord(bool Start) {
sys::TimeValue user(0,0);
sys::TimeValue sys(0,0);
- size_t MemUsed = 0;
+ ssize_t MemUsed = 0;
if (Start) {
sys::Process::GetTimeUsage(now,user,sys);
MemUsed = getMemUsage();