Skip to content

Commit 2472e65

Browse files
johnislarrygrabbou
authored andcommitted
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
1 parent 7709285 commit 2472e65

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ public void execute() {
626626
private long mProfiledBatchRunStartTime;
627627
private long mProfiledBatchBatchedExecutionTime;
628628
private long mProfiledBatchNonBatchedExecutionTime;
629+
private long mThreadCpuTime;
629630

630631
public UIViewOperationQueue(
631632
ReactApplicationContext reactContext,
@@ -664,6 +665,7 @@ public Map<String, Long> getProfiledBatchPerfCounters() {
664665
perfMap.put("RunStartTime", mProfiledBatchRunStartTime);
665666
perfMap.put("BatchedExecutionTime", mProfiledBatchBatchedExecutionTime);
666667
perfMap.put("NonBatchedExecutionTime", mProfiledBatchNonBatchedExecutionTime);
668+
perfMap.put("NativeModulesThreadCpuTime", mThreadCpuTime);
667669
return perfMap;
668670
}
669671

@@ -866,6 +868,7 @@ public void dispatchViewUpdates(
866868
.flush();
867869
try {
868870
final long dispatchViewUpdatesTime = SystemClock.uptimeMillis();
871+
final long nativeModulesThreadCpuTime = SystemClock.currentThreadTimeMillis();
869872

870873
// Store the current operation queues to dispatch and create new empty ones to continue
871874
// receiving new operations
@@ -920,6 +923,7 @@ public void run() {
920923
mProfiledBatchLayoutTime = layoutTime;
921924
mProfiledBatchDispatchViewUpdatesTime = dispatchViewUpdatesTime;
922925
mProfiledBatchRunStartTime = runStartTime;
926+
mThreadCpuTime = nativeModulesThreadCpuTime;
923927

924928
Systrace.beginAsyncSection(
925929
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,

0 commit comments

Comments
 (0)