Bug 678126 - Add "tjit-data/trace-monitor" memory reporter. r=dmandelin.

This commit is contained in:
Nicholas Nethercote 2011-08-14 19:45:38 -07:00
parent 0e6f0b05b1
commit fa9fc14205
4 changed files with 29 additions and 0 deletions

View File

@ -287,6 +287,7 @@ struct TraceMonitor {
JS_FRIEND_API(void) getCodeAllocStats(size_t &total, size_t &frag_size, size_t &free_size) const;
JS_FRIEND_API(size_t) getVMAllocatorsMainSize() const;
JS_FRIEND_API(size_t) getVMAllocatorsReserveSize() const;
JS_FRIEND_API(size_t) getTraceMonitorSize() const;
};
namespace mjit {

View File

@ -2517,6 +2517,15 @@ TraceMonitor::getVMAllocatorsReserveSize() const
tempAlloc->mReserveSize;
}
size_t
TraceMonitor::getTraceMonitorSize() const
{
return sizeof(TraceMonitor) + // TraceMonitor
sizeof(*storage) + // TraceNativeStorage
recordAttempts->tableSize() + // RecordAttemptMap
loopProfiles->tableSize(); // LoopProfileMap
}
/*
* This function destroys the recorder after a successful recording, possibly
* starting a suspended outer recorder.

View File

@ -1315,6 +1315,14 @@ GetCompartmentTjitDataAllocatorsReserveSize(JSCompartment *c)
: 0;
}
PRInt64
GetCompartmentTjitDataTraceMonitorSize(JSCompartment *c)
{
return c->hasTraceMonitor()
? c->traceMonitor()->getTraceMonitorSize()
: 0;
}
#endif // JS_TRACER
void
@ -1337,6 +1345,7 @@ CompartmentCallback(JSContext *cx, void *vdata, JSCompartment *compartment)
curr->tjitCode = GetCompartmentTjitCodeSize(compartment);
curr->tjitDataAllocatorsMain = GetCompartmentTjitDataAllocatorsMainSize(compartment);
curr->tjitDataAllocatorsReserve = GetCompartmentTjitDataAllocatorsReserveSize(compartment);
curr->tjitDataNonAllocators = GetCompartmentTjitDataTraceMonitorSize(compartment);
#endif
}
@ -1803,6 +1812,15 @@ ReportCompartmentStats(const CompartmentStats &stats,
"Memory used by the trace JIT and held in reserve for the compartment's "
"VMAllocators in case of OOM.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"tjit-data/trace-monitor"),
nsIMemoryReporter::KIND_HEAP,
stats.tjitDataNonAllocators,
"Memory used by the trace JIT that is stored in the TraceMonitor. This "
"includes the TraceMonitor object itself, plus its TraceNativeStorage, "
"RecordAttemptMap, and LoopProfileMap.",
callback, closure);
#endif
}

View File

@ -219,6 +219,7 @@ struct CompartmentStats
PRInt64 tjitCode;
PRInt64 tjitDataAllocatorsMain;
PRInt64 tjitDataAllocatorsReserve;
PRInt64 tjitDataNonAllocators;
#endif
};