mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
update JSTime to last call
Summary: ChangeLog: [General] [Added] - support PerformanceLogger stopTimespan updates Reviewed By: alexeylang Differential Revision: D20095949 fbshipit-source-id: 3522a8d16ced44d6b699b294004371e223f9f619
This commit is contained in:
committed by
Facebook Github Bot
parent
c938c0afbf
commit
08c338eebf
@@ -29,7 +29,7 @@ type Timespan = {
|
||||
export type IPerformanceLogger = {
|
||||
addTimespan(string, number, string | void): void,
|
||||
startTimespan(string, string | void): void,
|
||||
stopTimespan(string): void,
|
||||
stopTimespan(string, options?: {update?: boolean}): void,
|
||||
clear(): void,
|
||||
clearCompleted(): void,
|
||||
clearExceptTimespans(Array<string>): void,
|
||||
@@ -107,7 +107,7 @@ function createPerformanceLogger(): IPerformanceLogger {
|
||||
}
|
||||
},
|
||||
|
||||
stopTimespan(key: string) {
|
||||
stopTimespan(key: string, options?: {update?: boolean}) {
|
||||
const timespan = this._timespans[key];
|
||||
if (!timespan || !timespan.startTime) {
|
||||
if (PRINT_TO_CONSOLE && __DEV__) {
|
||||
@@ -118,7 +118,7 @@ function createPerformanceLogger(): IPerformanceLogger {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (timespan.endTime) {
|
||||
if (timespan.endTime && !options?.update) {
|
||||
if (PRINT_TO_CONSOLE && __DEV__) {
|
||||
infoLog(
|
||||
'PerformanceLogger: Attempting to end a timespan that has already ended ',
|
||||
@@ -134,8 +134,10 @@ function createPerformanceLogger(): IPerformanceLogger {
|
||||
infoLog('PerformanceLogger.js', 'end: ' + key);
|
||||
}
|
||||
|
||||
Systrace.endAsyncEvent(key, _cookies[key]);
|
||||
delete _cookies[key];
|
||||
if (_cookies[key] != null) {
|
||||
Systrace.endAsyncEvent(key, _cookies[key]);
|
||||
delete _cookies[key];
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
|
||||
Reference in New Issue
Block a user