Track plugin activation time

Summary: Track the time from when the plugin is selected until its `init()` function finishes.

Reviewed By: passy

Differential Revision: D9239750

fbshipit-source-id: 569f236c9d58f70548f1ba6bf31a96047dcc8245
This commit is contained in:
Daniel Büchele
2018-08-10 09:29:28 -07:00
committed by Facebook Github Bot
parent 800302b433
commit faf8afe9cd
2 changed files with 6 additions and 1 deletions

View File

@@ -108,6 +108,7 @@ class PluginContainer extends Component<Props, State> {
if (ref && target) { if (ref && target) {
activateMenuItems(ref); activateMenuItems(ref);
ref._init(); ref._init();
this.props.logger.trackTimeSince(`activePlugin-${ref.id}`);
this.plugin = ref; this.plugin = ref;
} }
}; };

View File

@@ -156,12 +156,16 @@ export default function reducer(
} }
case 'SELECT_PLUGIN': { case 'SELECT_PLUGIN': {
const {payload} = action; const {payload} = action;
const {selectedPlugin} = payload;
if (selectedPlugin) {
performance.mark(`activePlugin-${selectedPlugin}`);
}
return { return {
...state, ...state,
...payload, ...payload,
userPreferredApp: payload.selectedApp, userPreferredApp: payload.selectedApp,
userPreferredPlugin: payload.selectedPlugin, userPreferredPlugin: selectedPlugin,
}; };
} }