Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split trace blocks inside of IntBufferBatchMountItem by type of operation #44897

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
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 @@ -74,25 +72,6 @@ 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 @@ -111,13 +90,15 @@ 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++];
int type = rawType & ~INSTRUCTION_FLAG_MULTIPLE;
int numInstructions = ((rawType & INSTRUCTION_FLAG_MULTIPLE) != 0 ? mIntBuffer[i++] : 1);

Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"IntBufferBatchMountItem::mountInstructions::" + nameForInstructionString(type));
for (int k = 0; k < numInstructions; k++) {
if (type == INSTRUCTION_CREATE) {
String componentName = getFabricComponentName((String) mObjBuffer[j++]);
Expand Down Expand Up @@ -184,9 +165,8 @@ public void execute(MountingManager mountingManager) {
"Invalid type argument to IntBufferBatchMountItem: " + type + " at index: " + i);
}
}
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}

endMarkers();
}

@Override
Expand Down Expand Up @@ -308,4 +288,32 @@ public String toString() {
return "";
}
}

private static String nameForInstructionString(int type) {
if (type == INSTRUCTION_CREATE) {
return "CREATE";
} else if (type == INSTRUCTION_DELETE) {
return "DELETE";
} else if (type == INSTRUCTION_INSERT) {
return "INSERT";
} else if (type == INSTRUCTION_REMOVE) {
return "REMOVE";
} else if (type == INSTRUCTION_REMOVE_DELETE_TREE) {
return "REMOVE_DELETE_TREE";
} else if (type == INSTRUCTION_UPDATE_PROPS) {
return "UPDATE_PROPS";
} else if (type == INSTRUCTION_UPDATE_STATE) {
return "UPDATE_STATE";
} else if (type == INSTRUCTION_UPDATE_LAYOUT) {
return "UPDATE_LAYOUT";
} else if (type == INSTRUCTION_UPDATE_PADDING) {
return "UPDATE_PADDING";
} else if (type == INSTRUCTION_UPDATE_OVERFLOW_INSET) {
return "UPDATE_OVERFLOW_INSET";
} else if (type == INSTRUCTION_UPDATE_EVENT_EMITTER) {
return "UPDATE_EVENT_EMITTER";
} else {
return "UNKNOWN";
}
}
}
Loading