mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1298541: Tracelogger: Part 1: Add debugging to check start and stop correspond, r=bbouvier
This commit is contained in:
parent
64a98fc3b7
commit
4cd9e8a154
@ -491,6 +491,14 @@ TraceLoggerThread::startEvent(uint32_t id)
|
||||
if (!traceLoggerState->isTextIdEnabled(id))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (enabled > 0) {
|
||||
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||
if (!graphStack.append(id))
|
||||
oomUnsafe.crash("Could not add item to debug stack.");
|
||||
}
|
||||
#endif
|
||||
|
||||
log(id);
|
||||
}
|
||||
|
||||
@ -516,6 +524,23 @@ TraceLoggerThread::stopEvent(uint32_t id)
|
||||
if (!traceLoggerState->isTextIdEnabled(id))
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (enabled > 0) {
|
||||
uint32_t prev = graphStack.popCopy();
|
||||
if (id == TraceLogger_Engine) {
|
||||
MOZ_ASSERT(prev == TraceLogger_IonMonkey || prev == TraceLogger_Baseline ||
|
||||
prev == TraceLogger_Interpreter);
|
||||
} else if (id == TraceLogger_Scripts) {
|
||||
MOZ_ASSERT(prev >= TraceLogger_Last);
|
||||
} else if (id >= TraceLogger_Last) {
|
||||
MOZ_ASSERT(prev >= TraceLogger_Last);
|
||||
MOZ_ASSERT_IF(prev != id, strcmp(eventText(id), eventText(prev)) == 0);
|
||||
} else {
|
||||
MOZ_ASSERT(id == prev);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
log(TraceLogger_Stop);
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,11 @@ class TraceLoggerThread
|
||||
// event.
|
||||
uint32_t iteration_;
|
||||
|
||||
#ifdef DEBUG
|
||||
typedef Vector<uint32_t, 1, js::SystemAllocPolicy > GraphStack;
|
||||
GraphStack graphStack;
|
||||
#endif
|
||||
|
||||
public:
|
||||
AutoTraceLog* top;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user