Skip to content

Commit

Permalink
Record thread cpu time for native modules thread
Browse files Browse the repository at this point in the history
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
  • Loading branch information
johnislarry authored and grabbou committed Dec 17, 2018
1 parent 7709285 commit 2472e65
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ public void execute() {
private long mProfiledBatchRunStartTime;
private long mProfiledBatchBatchedExecutionTime;
private long mProfiledBatchNonBatchedExecutionTime;
private long mThreadCpuTime;

public UIViewOperationQueue(
ReactApplicationContext reactContext,
Expand Down Expand Up @@ -664,6 +665,7 @@ public Map<String, Long> getProfiledBatchPerfCounters() {
perfMap.put("RunStartTime", mProfiledBatchRunStartTime);
perfMap.put("BatchedExecutionTime", mProfiledBatchBatchedExecutionTime);
perfMap.put("NonBatchedExecutionTime", mProfiledBatchNonBatchedExecutionTime);
perfMap.put("NativeModulesThreadCpuTime", mThreadCpuTime);
return perfMap;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -920,6 +923,7 @@ public void run() {
mProfiledBatchLayoutTime = layoutTime;
mProfiledBatchDispatchViewUpdatesTime = dispatchViewUpdatesTime;
mProfiledBatchRunStartTime = runStartTime;
mThreadCpuTime = nativeModulesThreadCpuTime;

Systrace.beginAsyncSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
Expand Down

0 comments on commit 2472e65

Please sign in to comment.