From faf8afe9cdf86549eb22aa209f649a89a78c1085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Fri, 10 Aug 2018 09:29:28 -0700 Subject: [PATCH] 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 --- src/PluginContainer.js | 1 + src/reducers/connections.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PluginContainer.js b/src/PluginContainer.js index 40e517d11..6595039a9 100644 --- a/src/PluginContainer.js +++ b/src/PluginContainer.js @@ -108,6 +108,7 @@ class PluginContainer extends Component { if (ref && target) { activateMenuItems(ref); ref._init(); + this.props.logger.trackTimeSince(`activePlugin-${ref.id}`); this.plugin = ref; } }; diff --git a/src/reducers/connections.js b/src/reducers/connections.js index 729d955a9..c8a49ee1c 100644 --- a/src/reducers/connections.js +++ b/src/reducers/connections.js @@ -156,12 +156,16 @@ export default function reducer( } case 'SELECT_PLUGIN': { const {payload} = action; + const {selectedPlugin} = payload; + if (selectedPlugin) { + performance.mark(`activePlugin-${selectedPlugin}`); + } return { ...state, ...payload, userPreferredApp: payload.selectedApp, - userPreferredPlugin: payload.selectedPlugin, + userPreferredPlugin: selectedPlugin, }; }