mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 00:39:36 +00:00
* Add new -track-memory option to tools which enables the mem usage column in the reports.
This is now optional (and defaults to off) because mallinfo can be VERY slow as it seems to touch every page of allocated memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49f2012140
commit
3f39849003
@ -5,6 +5,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Support/Timer.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/unistd.h>
|
||||
@ -15,6 +16,13 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
namespace {
|
||||
cl::opt<bool>
|
||||
TrackSpace("track-memory", cl::desc("Enable -time-passes memory "
|
||||
"tracking (this may be slow)"),
|
||||
cl::Hidden);
|
||||
}
|
||||
|
||||
// getNumBytesToNotCount - This function is supposed to return the number of
|
||||
// bytes that are to be considered not allocated, even though malloc thinks they
|
||||
// are allocated.
|
||||
@ -65,8 +73,12 @@ Timer::~Timer() {
|
||||
}
|
||||
|
||||
static long getMemUsage() {
|
||||
struct mallinfo MI = mallinfo();
|
||||
return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/;
|
||||
if (TrackSpace) {
|
||||
struct mallinfo MI = mallinfo();
|
||||
return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct TimeRecord {
|
||||
|
@ -5,6 +5,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Support/Timer.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/unistd.h>
|
||||
@ -15,6 +16,13 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
namespace {
|
||||
cl::opt<bool>
|
||||
TrackSpace("track-memory", cl::desc("Enable -time-passes memory "
|
||||
"tracking (this may be slow)"),
|
||||
cl::Hidden);
|
||||
}
|
||||
|
||||
// getNumBytesToNotCount - This function is supposed to return the number of
|
||||
// bytes that are to be considered not allocated, even though malloc thinks they
|
||||
// are allocated.
|
||||
@ -65,8 +73,12 @@ Timer::~Timer() {
|
||||
}
|
||||
|
||||
static long getMemUsage() {
|
||||
struct mallinfo MI = mallinfo();
|
||||
return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/;
|
||||
if (TrackSpace) {
|
||||
struct mallinfo MI = mallinfo();
|
||||
return MI.uordblks/*+MI.hblkhd-getNumBytesToNotCount()*/;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct TimeRecord {
|
||||
|
Loading…
x
Reference in New Issue
Block a user