Add logging of statistics of Fabric commits

Summary:
This diff adds extra logging to track how long does it take to exeucte different stages of the fabric commit

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D33183070

fbshipit-source-id: 69e31bef69c9d9ec57dc7e00e4c36e278eb30cb6
This commit is contained in:
David Vacca
2021-12-17 09:59:43 -08:00
committed by Facebook GitHub Bot
parent 58532ed52f
commit 08aab2b4e1
@@ -716,6 +716,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
// When Binding.cpp calls scheduleMountItems during a commit phase, it always calls with
// a BatchMountItem. No other sites call into this with a BatchMountItem, and Binding.cpp only
// calls scheduleMountItems with a BatchMountItem.
long scheduleMountItemStartTime = SystemClock.uptimeMillis();
boolean isBatchMountItem = mountItem instanceof IntBufferBatchMountItem;
boolean shouldSchedule =
(isBatchMountItem && ((IntBufferBatchMountItem) mountItem).shouldSchedule())
@@ -731,7 +732,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
mCommitStartTime = commitStartTime;
mLayoutTime = layoutEndTime - layoutStartTime;
mFinishTransactionCPPTime = finishTransactionEndTime - finishTransactionStartTime;
mFinishTransactionTime = SystemClock.uptimeMillis() - finishTransactionStartTime;
mFinishTransactionTime = scheduleMountItemStartTime - finishTransactionStartTime;
mDispatchViewUpdatesTime = SystemClock.uptimeMillis();
}
@@ -766,6 +767,23 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
ReactMarker.logFabricMarker(
ReactMarkerConstants.FABRIC_LAYOUT_END, null, commitNumber, layoutEndTime);
ReactMarker.logFabricMarker(ReactMarkerConstants.FABRIC_COMMIT_END, null, commitNumber);
if (ENABLE_FABRIC_LOGS) {
FLog.e(
TAG,
"Statistic of Fabric commit #: "
+ commitNumber
+ "\n - Total commit time: "
+ (finishTransactionEndTime - commitStartTime)
+ " ms.\n - Layout: "
+ mLayoutTime
+ " ms.\n - Diffing: "
+ (diffEndTime - diffStartTime)
+ " ms.\n"
+ " - FinishTransaction (Diffing + Processing + Serialization of MountingInstructions): "
+ mFinishTransactionCPPTime
+ " ms.");
}
}
}