Skip to content

Commit

Permalink
Fix logging of internals of React Native renderer (#46562)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #46562

This diff if fixing the logging of internal statistics of React Native Android renderer

changelog: [internal] intenral

Reviewed By: javache

Differential Revision: D59985973

fbshipit-source-id: 5f5020a516d236ef41b0bff087b00e7d7c721bb8
  • Loading branch information
mdvacca authored and facebook-github-bot committed Sep 18, 2024
1 parent fea0aa7 commit 40638b8
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.fabric.events.EventEmitterWrapper;
import com.facebook.react.fabric.mounting.MountingManager;
Expand Down Expand Up @@ -70,6 +72,25 @@ final class IntBufferBatchMountItem implements BatchMountItem {
mObjBufferLen = mObjBuffer.length;
}

private void beginMarkers(String reason) {
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "IntBufferBatchMountItem::" + reason);

if (mCommitNumber > 0) {
ReactMarker.logFabricMarker(
ReactMarkerConstants.FABRIC_BATCH_EXECUTION_START, null, mCommitNumber);
}
}

private void endMarkers() {
if (mCommitNumber > 0) {
ReactMarker.logFabricMarker(
ReactMarkerConstants.FABRIC_BATCH_EXECUTION_END, null, mCommitNumber);
}

Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}

@Override
public void execute(MountingManager mountingManager) {
SurfaceMountingManager surfaceMountingManager = mountingManager.getSurfaceManager(mSurfaceId);
Expand All @@ -88,6 +109,7 @@ public void execute(MountingManager mountingManager) {
FLog.d(TAG, "Executing IntBufferBatchMountItem on surface [%d]", mSurfaceId);
}

beginMarkers("mountViews");
int i = 0, j = 0;
while (i < mIntBufferLen) {
int rawType = mIntBuffer[i++];
Expand Down Expand Up @@ -166,6 +188,7 @@ public void execute(MountingManager mountingManager) {
}
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
endMarkers();
}

@Override
Expand Down

0 comments on commit 40638b8

Please sign in to comment.