mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-02 05:17:15 +00:00
Use size_t instead of long to represent memory usage. long is 32 bits
on 64-bit Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19393 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -36,9 +36,9 @@ class Timer {
|
|||||||
double Elapsed; // Wall clock time elapsed in seconds
|
double Elapsed; // Wall clock time elapsed in seconds
|
||||||
double UserTime; // User time elapsed
|
double UserTime; // User time elapsed
|
||||||
double SystemTime; // System time elapsed
|
double SystemTime; // System time elapsed
|
||||||
long MemUsed; // Memory allocated (in bytes)
|
size_t MemUsed; // Memory allocated (in bytes)
|
||||||
long PeakMem; // Peak memory used
|
size_t PeakMem; // Peak memory used
|
||||||
long PeakMemBase; // Temporary for peak calculation...
|
size_t PeakMemBase; // Temporary for peak 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.
|
||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
|
|
||||||
double getProcessTime() const { return UserTime+SystemTime; }
|
double getProcessTime() const { return UserTime+SystemTime; }
|
||||||
double getWallTime() const { return Elapsed; }
|
double getWallTime() const { return Elapsed; }
|
||||||
long getMemUsed() const { return MemUsed; }
|
size_t getMemUsed() const { return MemUsed; }
|
||||||
long getPeakMem() const { return PeakMem; }
|
size_t getPeakMem() const { return PeakMem; }
|
||||||
std::string getName() const { return Name; }
|
std::string getName() const { return Name; }
|
||||||
|
|
||||||
const Timer &operator=(const Timer &T) {
|
const Timer &operator=(const Timer &T) {
|
||||||
|
@@ -40,14 +40,14 @@ namespace sys {
|
|||||||
/// allocated space.
|
/// allocated space.
|
||||||
/// @throws nothing
|
/// @throws nothing
|
||||||
/// @brief Return process memory usage.
|
/// @brief Return process memory usage.
|
||||||
static uint64_t GetMallocUsage();
|
static size_t GetMallocUsage();
|
||||||
|
|
||||||
/// This static function will return the total memory usage of the
|
/// This static function will return the total memory usage of the
|
||||||
/// process. This includes code, data, stack and mapped pages usage. Notei
|
/// process. This includes code, data, stack and mapped pages usage. Notei
|
||||||
/// that the value returned here is not necessarily the Running Set Size,
|
/// that the value returned here is not necessarily the Running Set Size,
|
||||||
/// it is the total virtual memory usage, regardless of mapped state of
|
/// it is the total virtual memory usage, regardless of mapped state of
|
||||||
/// that memory.
|
/// that memory.
|
||||||
static uint64_t GetTotalMemoryUsage();
|
static size_t GetTotalMemoryUsage();
|
||||||
|
|
||||||
/// This static function will set \p user_time to the amount of CPU time
|
/// This static function will set \p user_time to the amount of CPU time
|
||||||
/// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
|
/// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
|
||||||
|
@@ -93,15 +93,15 @@ Timer::~Timer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long getMemUsage() {
|
static inline size_t getMemUsage() {
|
||||||
if (TrackSpace)
|
if (TrackSpace)
|
||||||
return (long)sys::Process::GetMallocUsage();
|
return sys::Process::GetMallocUsage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimeRecord {
|
struct TimeRecord {
|
||||||
double Elapsed, UserTime, SystemTime;
|
double Elapsed, UserTime, SystemTime;
|
||||||
long MemUsed;
|
size_t MemUsed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static TimeRecord getTimeRecord(bool Start) {
|
static TimeRecord getTimeRecord(bool Start) {
|
||||||
@@ -111,7 +111,7 @@ static TimeRecord getTimeRecord(bool Start) {
|
|||||||
sys::TimeValue user(0,0);
|
sys::TimeValue user(0,0);
|
||||||
sys::TimeValue sys(0,0);
|
sys::TimeValue sys(0,0);
|
||||||
|
|
||||||
long MemUsed = 0;
|
size_t MemUsed = 0;
|
||||||
if (Start) {
|
if (Start) {
|
||||||
sys::Process::GetTimeUsage(now,user,sys);
|
sys::Process::GetTimeUsage(now,user,sys);
|
||||||
MemUsed = getMemUsage();
|
MemUsed = getMemUsage();
|
||||||
@@ -171,7 +171,7 @@ void Timer::sum(const Timer &T) {
|
|||||||
/// currently active timers, which will be printed when the timer group prints
|
/// currently active timers, which will be printed when the timer group prints
|
||||||
///
|
///
|
||||||
void Timer::addPeakMemoryMeasurement() {
|
void Timer::addPeakMemoryMeasurement() {
|
||||||
long MemUsed = getMemUsage();
|
size_t MemUsed = getMemUsage();
|
||||||
|
|
||||||
for (std::vector<Timer*>::iterator I = ActiveTimers.begin(),
|
for (std::vector<Timer*>::iterator I = ActiveTimers.begin(),
|
||||||
E = ActiveTimers.end(); I != E; ++I)
|
E = ActiveTimers.end(); I != E; ++I)
|
||||||
|
@@ -47,7 +47,7 @@ Process::GetPageSize()
|
|||||||
static char* som = reinterpret_cast<char*>(::sbrk(0));
|
static char* som = reinterpret_cast<char*>(::sbrk(0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetMallocUsage()
|
Process::GetMallocUsage()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
@@ -68,7 +68,7 @@ Process::GetMallocUsage()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetTotalMemoryUsage()
|
Process::GetTotalMemoryUsage()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
|
@@ -47,7 +47,7 @@ Process::GetPageSize()
|
|||||||
static char* som = reinterpret_cast<char*>(::sbrk(0));
|
static char* som = reinterpret_cast<char*>(::sbrk(0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetMallocUsage()
|
Process::GetMallocUsage()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
@@ -68,7 +68,7 @@ Process::GetMallocUsage()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetTotalMemoryUsage()
|
Process::GetTotalMemoryUsage()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_MALLINFO)
|
#if defined(HAVE_MALLINFO)
|
||||||
|
@@ -51,7 +51,7 @@ Process::GetPageSize() {
|
|||||||
return PageSize;
|
return PageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetMallocUsage()
|
Process::GetMallocUsage()
|
||||||
{
|
{
|
||||||
_HEAPINFO hinfo;
|
_HEAPINFO hinfo;
|
||||||
@@ -65,7 +65,7 @@ Process::GetMallocUsage()
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetTotalMemoryUsage()
|
Process::GetTotalMemoryUsage()
|
||||||
{
|
{
|
||||||
PROCESS_MEMORY_COUNTERS pmc;
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
|
@@ -51,7 +51,7 @@ Process::GetPageSize() {
|
|||||||
return PageSize;
|
return PageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetMallocUsage()
|
Process::GetMallocUsage()
|
||||||
{
|
{
|
||||||
_HEAPINFO hinfo;
|
_HEAPINFO hinfo;
|
||||||
@@ -65,7 +65,7 @@ Process::GetMallocUsage()
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
size_t
|
||||||
Process::GetTotalMemoryUsage()
|
Process::GetTotalMemoryUsage()
|
||||||
{
|
{
|
||||||
PROCESS_MEMORY_COUNTERS pmc;
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
|
Reference in New Issue
Block a user