Log timer identifiers in systrace

Reviewed By: davidaurelio

Differential Revision: D3819518

fbshipit-source-id: 98e9ed4af93c9c02f4bb8d9152b19556566b81f1
This commit is contained in:
Pieter De Baets
2016-09-06 03:58:00 -07:00
committed by Facebook Github Bot 4
parent 66ce1297c2
commit a1f31d12fd
2 changed files with 20 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ const JSTimersExecution = {
timerIDs: [],
immediates: [],
requestIdleCallbacks: [],
identifiers: ([] : [{methodName: string}]),
errors: (null : ?[Error]),
@@ -78,6 +79,11 @@ const JSTimersExecution = {
return;
}
if (__DEV__) {
const identifier = JSTimersExecution.identifiers[timerIndex] || {};
Systrace.beginEvent('Systrace.callTimer: ' + identifier.methodName);
}
// Clear the metadata
if (type === JSTimersExecution.Type.setTimeout ||
type === JSTimersExecution.Type.setImmediate ||
@@ -113,6 +119,10 @@ const JSTimersExecution = {
JSTimersExecution.errors.push(e);
}
}
if (__DEV__) {
Systrace.endEvent();
}
},
/**
@@ -228,6 +238,7 @@ const JSTimersExecution = {
JSTimersExecution.timerIDs[i] = null;
JSTimersExecution.callbacks[i] = null;
JSTimersExecution.types[i] = null;
JSTimersExecution.identifiers[i] = null;
},
};