Add marker start and end to App to measure the startup time for Flipper (#1398)

Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1398

Pull Request resolved: https://github.com/facebook/flipper/pull/1397

Reviewed By: nubbel

Differential Revision: D22549700

fbshipit-source-id: 7553ba075e45f1a515922012d7db4fdefefcaa24
This commit is contained in:
Nicole Stiliyan Vukadinova
2020-07-23 07:28:22 -07:00
committed by Facebook GitHub Bot
parent 33cd7d29df
commit 7d06571cfa
3 changed files with 68 additions and 0 deletions

View File

@@ -46,6 +46,10 @@ import StatusBar from './chrome/StatusBar';
import SettingsSheet from './chrome/SettingsSheet'; import SettingsSheet from './chrome/SettingsSheet';
import DoctorSheet from './chrome/DoctorSheet'; import DoctorSheet from './chrome/DoctorSheet';
import ChangelogSheet, {hasNewChangesToShow} from './chrome/ChangelogSheet'; import ChangelogSheet, {hasNewChangesToShow} from './chrome/ChangelogSheet';
import QuickPerformanceLogger, {
QuickLogActionType,
FLIPPER_QPL_EVENTS,
} from './fb-stubs/QPL';
const version = remote.app.getVersion(); const version = remote.app.getVersion();
@@ -88,7 +92,23 @@ export class App extends React.Component<Props> {
'launchTime', 'launchTime',
launchEndTime - launchStartTime, launchEndTime - launchStartTime,
); );
QuickPerformanceLogger.markerPoint(
FLIPPER_QPL_EVENTS.STARTUP,
'launchStartTime',
undefined,
0,
launchStartTime,
);
QuickPerformanceLogger.markerEnd(
FLIPPER_QPL_EVENTS.STARTUP,
QuickLogActionType.SUCCESS,
0,
launchEndTime,
);
}); });
ipcRenderer.send('getLaunchTime'); ipcRenderer.send('getLaunchTime');
ipcRenderer.send('componentDidMount'); ipcRenderer.send('componentDidMount');

View File

@@ -0,0 +1,45 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export enum QuickLogActionType {
START = 1,
SUCCESS = 2,
FAIL = 3,
CANCEL = 4,
CANCEL_UNLOAD = 706,
INTERRUPTED = 96,
}
export enum FLIPPER_QPL_EVENTS {
STARTUP = 52035585,
}
class QuickPerformanceLogger {
markerStart(
_markerId: number,
_instanceKey?: number,
_timestamp?: DOMHighResTimeStamp,
): void {}
markerPoint(
_markerId: number,
_name: string,
_data?: string,
_instanceKey?: number,
_timestamp?: DOMHighResTimeStamp,
): void {}
markerEnd(
_markerId: number,
_action: QuickLogActionType,
_instanceKey?: number,
_timestamp?: DOMHighResTimeStamp,
): void {}
}
export default new QuickPerformanceLogger();

View File

@@ -34,6 +34,7 @@ import {cache} from 'emotion';
import {CacheProvider} from '@emotion/core'; import {CacheProvider} from '@emotion/core';
import {enableMapSet} from 'immer'; import {enableMapSet} from 'immer';
import os from 'os'; import os from 'os';
import QuickPerformanceLogger, {FLIPPER_QPL_EVENTS} from './fb-stubs/QPL';
if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') { if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') {
// By default Node.JS has its internal certificate storage and doesn't use // By default Node.JS has its internal certificate storage and doesn't use
@@ -46,6 +47,8 @@ if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') {
const logger = initLogger(store); const logger = initLogger(store);
QuickPerformanceLogger.markerStart(FLIPPER_QPL_EVENTS.STARTUP);
enableMapSet(); enableMapSet();
GK.init(); GK.init();