mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01: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. llvm-svn: 5448
This commit is contained in:
parent
dcf38586ef
commit
bedb4f4a83
@ -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…
Reference in New Issue
Block a user