-
Notifications
You must be signed in to change notification settings - Fork 24k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logging in GlobalPerformanceLogger via WebPerformance API (#36402)
Summary: Pull Request resolved: #36402 ## Changelog: [Internal] - Makes `GlobalPerformanceLogger` (`IPerformanceLogger` API), additionally use the native WebPerformance implementation (`Performance` and `PerformanceObserver` APIs) to log points/timespans as marks/measures correspondingly. This will ultimately help to converge performance logging facilities across platforms and language boundaries. In a shorter term, it can serve as a good case study of using the Web Performance API implementation. Note that this implementation is disabled by default (controlled by the RN feature flag), and will be enabled separately via na experiment. Reviewed By: rubennorte Differential Revision: D43873560 fbshipit-source-id: 22e2d787c8f22d2f67556dfe4bf175743eca2caf
- Loading branch information
1 parent
3cd97e4
commit 48c7adc
Showing
7 changed files
with
126 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
* @format | ||
*/ | ||
|
||
export type Timespan = { | ||
startTime: number, | ||
endTime?: number, | ||
totalTime?: number, | ||
startExtras?: Extras, | ||
endExtras?: Extras, | ||
}; | ||
|
||
// Extra values should be serializable primitives | ||
export type ExtraValue = number | string | boolean; | ||
|
||
export type Extras = {[key: string]: ExtraValue}; | ||
|
||
export interface IPerformanceLogger { | ||
addTimespan( | ||
key: string, | ||
startTime: number, | ||
endTime: number, | ||
startExtras?: Extras, | ||
endExtras?: Extras, | ||
): void; | ||
append(logger: IPerformanceLogger): void; | ||
clear(): void; | ||
clearCompleted(): void; | ||
close(): void; | ||
currentTimestamp(): number; | ||
getExtras(): $ReadOnly<{[key: string]: ?ExtraValue, ...}>; | ||
getPoints(): $ReadOnly<{[key: string]: ?number, ...}>; | ||
getPointExtras(): $ReadOnly<{[key: string]: ?Extras, ...}>; | ||
getTimespans(): $ReadOnly<{[key: string]: ?Timespan, ...}>; | ||
hasTimespan(key: string): boolean; | ||
isClosed(): boolean; | ||
logEverything(): void; | ||
markPoint(key: string, timestamp?: number, extras?: Extras): void; | ||
removeExtra(key: string): ?ExtraValue; | ||
setExtra(key: string, value: ExtraValue): void; | ||
startTimespan(key: string, timestamp?: number, extras?: Extras): void; | ||
stopTimespan(key: string, timestamp?: number, extras?: Extras): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters