Skip to content

Commit

Permalink
update JSTime to last call
Browse files Browse the repository at this point in the history
Summary: ChangeLog: [General] [Added] - support PerformanceLogger stopTimespan updates

Reviewed By: alexeylang

Differential Revision: D20095949

fbshipit-source-id: 3522a8d16ced44d6b699b294004371e223f9f619
  • Loading branch information
sahrens authored and facebook-github-bot committed Mar 10, 2020
1 parent c938c0a commit 08c338e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Libraries/Utilities/createPerformanceLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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__) {
Expand All @@ -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 ',
Expand All @@ -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() {
Expand Down

0 comments on commit 08c338e

Please sign in to comment.