From ed9ecb5d73f9999af99145d992c2c0a43a17da41 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Wed, 28 Aug 2019 08:46:49 -0700 Subject: [PATCH] improve UIManager QPL markers Summary: The commit and batch points are just showing up as points in scuba relativity which isn't very useful - we want to know how long they take as well, so make them ranges. Also adds view creation and update counts as annotations which can be handy for debugging regressions. Reviewed By: JoshuaGross, axe-fb Differential Revision: D17083058 fbshipit-source-id: dd29d12731734252930c9a4424bddbb98a8acccf --- .../react/uimanager/UIViewOperationQueue.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java index abbe9c3f83f..9c7c31ec629 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -535,12 +535,16 @@ public class UIViewOperationQueue { private boolean mIsProfilingNextBatch = false; private long mNonBatchedExecutionTotalTime; private long mProfiledBatchCommitStartTime; + private long mProfiledBatchCommitEndTime; private long mProfiledBatchLayoutTime; private long mProfiledBatchDispatchViewUpdatesTime; private long mProfiledBatchRunStartTime; + private long mProfiledBatchRunEndTime; private long mProfiledBatchBatchedExecutionTime; private long mProfiledBatchNonBatchedExecutionTime; private long mThreadCpuTime; + private long mCreateViewCount; + private long mUpdatePropertiesOperationCount; public UIViewOperationQueue( ReactApplicationContext reactContext, @@ -568,17 +572,23 @@ public class UIViewOperationQueue { public void profileNextBatch() { mIsProfilingNextBatch = true; mProfiledBatchCommitStartTime = 0; + mCreateViewCount = 0; + mUpdatePropertiesOperationCount = 0; } public Map getProfiledBatchPerfCounters() { Map perfMap = new HashMap<>(); perfMap.put("CommitStartTime", mProfiledBatchCommitStartTime); + perfMap.put("CommitEndTime", mProfiledBatchCommitEndTime); perfMap.put("LayoutTime", mProfiledBatchLayoutTime); perfMap.put("DispatchViewUpdatesTime", mProfiledBatchDispatchViewUpdatesTime); perfMap.put("RunStartTime", mProfiledBatchRunStartTime); + perfMap.put("RunEndTime", mProfiledBatchRunEndTime); perfMap.put("BatchedExecutionTime", mProfiledBatchBatchedExecutionTime); perfMap.put("NonBatchedExecutionTime", mProfiledBatchNonBatchedExecutionTime); perfMap.put("NativeModulesThreadCpuTime", mThreadCpuTime); + perfMap.put("CreateViewCount", mCreateViewCount); + perfMap.put("UpdatePropsCount", mUpdatePropertiesOperationCount); return perfMap; } @@ -644,6 +654,7 @@ public class UIViewOperationQueue { String viewClassName, @Nullable ReactStylesDiffMap initialProps) { synchronized (mNonBatchedOperationsLock) { + mCreateViewCount++; mNonBatchedOperations.addLast( new CreateViewOperation(themedContext, viewReactTag, viewClassName, initialProps)); } @@ -654,6 +665,7 @@ public class UIViewOperationQueue { } public void enqueueUpdateProperties(int reactTag, String className, ReactStylesDiffMap props) { + mUpdatePropertiesOperationCount++; mOperations.add(new UpdatePropertiesOperation(reactTag, props)); } @@ -782,9 +794,11 @@ public class UIViewOperationQueue { if (mIsProfilingNextBatch && mProfiledBatchCommitStartTime == 0) { mProfiledBatchCommitStartTime = commitStartTime; + mProfiledBatchCommitEndTime = SystemClock.uptimeMillis(); mProfiledBatchLayoutTime = layoutTime; mProfiledBatchDispatchViewUpdatesTime = dispatchViewUpdatesTime; mProfiledBatchRunStartTime = runStartTime; + mProfiledBatchRunEndTime = mProfiledBatchCommitEndTime; mThreadCpuTime = nativeModulesThreadCpuTime; Systrace.beginAsyncSection(