From 2472e65b621536fb170de1be343ecb09e78c97ac Mon Sep 17 00:00:00 2001 From: Max Sherman Date: Wed, 5 Dec 2018 12:16:00 -0800 Subject: [PATCH] Record thread cpu time for native modules thread Summary: I want the same instrumentation we did for the JS thread for the NM thread. This diff adds thread cpu time. Reviewed By: alexeylang Differential Revision: D13328876 fbshipit-source-id: 7b310956c52907ffbd881f864e1f8e774853d7f5 --- .../com/facebook/react/uimanager/UIViewOperationQueue.java | 4 ++++ 1 file changed, 4 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 80f447d836a5b3..68fec4b0737a31 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -626,6 +626,7 @@ public void execute() { private long mProfiledBatchRunStartTime; private long mProfiledBatchBatchedExecutionTime; private long mProfiledBatchNonBatchedExecutionTime; + private long mThreadCpuTime; public UIViewOperationQueue( ReactApplicationContext reactContext, @@ -664,6 +665,7 @@ public Map getProfiledBatchPerfCounters() { perfMap.put("RunStartTime", mProfiledBatchRunStartTime); perfMap.put("BatchedExecutionTime", mProfiledBatchBatchedExecutionTime); perfMap.put("NonBatchedExecutionTime", mProfiledBatchNonBatchedExecutionTime); + perfMap.put("NativeModulesThreadCpuTime", mThreadCpuTime); return perfMap; } @@ -866,6 +868,7 @@ public void dispatchViewUpdates( .flush(); try { final long dispatchViewUpdatesTime = SystemClock.uptimeMillis(); + final long nativeModulesThreadCpuTime = SystemClock.currentThreadTimeMillis(); // Store the current operation queues to dispatch and create new empty ones to continue // receiving new operations @@ -920,6 +923,7 @@ public void run() { mProfiledBatchLayoutTime = layoutTime; mProfiledBatchDispatchViewUpdatesTime = dispatchViewUpdatesTime; mProfiledBatchRunStartTime = runStartTime; + mThreadCpuTime = nativeModulesThreadCpuTime; Systrace.beginAsyncSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,