From eb316be4e4bd462810048248294eb01a87cd571c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Mon, 13 Aug 2018 15:14:11 -0700 Subject: [PATCH] fixing tracking metrics Summary: - fixing dropped frames calculation - fixing plugin activation time Reviewed By: passy Differential Revision: D9301759 fbshipit-source-id: 872e4d2edcafdbc67668f3d0b713dfbf55f068f5 --- src/PluginContainer.js | 2 +- src/dispatcher/tracking.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PluginContainer.js b/src/PluginContainer.js index 6595039a9..969d10c17 100644 --- a/src/PluginContainer.js +++ b/src/PluginContainer.js @@ -108,7 +108,7 @@ class PluginContainer extends Component { if (ref && target) { activateMenuItems(ref); ref._init(); - this.props.logger.trackTimeSince(`activePlugin-${ref.id}`); + this.props.logger.trackTimeSince(`activePlugin-${ref.constructor.id}`); this.plugin = ref; } }; diff --git a/src/dispatcher/tracking.js b/src/dispatcher/tracking.js index a7bb4ac13..ad4575b2d 100644 --- a/src/dispatcher/tracking.js +++ b/src/dispatcher/tracking.js @@ -18,8 +18,9 @@ export default (store: Store, logger: Logger) => { ) { const now = performance.now(); requestAnimationFrame(() => droppedFrameDetection(now, isWindowFocused)); - if (isWindowFocused()) { - droppedFrames += Math.max(0, Math.round(now - past / (1000 / 60) - 1)); + const dropped = Math.round((now - past) / (1000 / 60) - 1); + if (dropped > 0 && isWindowFocused()) { + droppedFrames += dropped; } }