Skip to content

Commit

Permalink
improve UIManager QPL markers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sahrens authored and facebook-github-bot committed Aug 28, 2019
1 parent 6f2e6f1 commit ed9ecb5
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,16 @@ public void execute() {
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,
Expand Down Expand Up @@ -568,17 +572,23 @@ public void setViewHierarchyUpdateDebugListener(
public void profileNextBatch() {
mIsProfilingNextBatch = true;
mProfiledBatchCommitStartTime = 0;
mCreateViewCount = 0;
mUpdatePropertiesOperationCount = 0;
}

public Map<String, Long> getProfiledBatchPerfCounters() {
Map<String, Long> 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;
}

Expand Down Expand Up @@ -644,6 +654,7 @@ public void enqueueCreateView(
String viewClassName,
@Nullable ReactStylesDiffMap initialProps) {
synchronized (mNonBatchedOperationsLock) {
mCreateViewCount++;
mNonBatchedOperations.addLast(
new CreateViewOperation(themedContext, viewReactTag, viewClassName, initialProps));
}
Expand All @@ -654,6 +665,7 @@ public void enqueueUpdateInstanceHandle(int reactTag, long instanceHandle) {
}

public void enqueueUpdateProperties(int reactTag, String className, ReactStylesDiffMap props) {
mUpdatePropertiesOperationCount++;
mOperations.add(new UpdatePropertiesOperation(reactTag, props));
}

Expand Down Expand Up @@ -782,9 +794,11 @@ public void run() {

if (mIsProfilingNextBatch && mProfiledBatchCommitStartTime == 0) {
mProfiledBatchCommitStartTime = commitStartTime;
mProfiledBatchCommitEndTime = SystemClock.uptimeMillis();
mProfiledBatchLayoutTime = layoutTime;
mProfiledBatchDispatchViewUpdatesTime = dispatchViewUpdatesTime;
mProfiledBatchRunStartTime = runStartTime;
mProfiledBatchRunEndTime = mProfiledBatchCommitEndTime;
mThreadCpuTime = nativeModulesThreadCpuTime;

Systrace.beginAsyncSection(
Expand Down

0 comments on commit ed9ecb5

Please sign in to comment.