mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-06 22:38:37 +08:00
SKETCH Add performance tracking for rendering
Differential Revision: D3709400 fbshipit-source-id: a006b60feb3fc5cb55cc2e6f08275fcc8de1d3e1
This commit is contained in:
committed by
Facebook Github Bot 4
parent
5d32075363
commit
16f76d4407
@@ -46,6 +46,9 @@ public class UIImplementation {
|
||||
private final int[] mMeasureBuffer = new int[4];
|
||||
private final ReactApplicationContext mReactContext;
|
||||
|
||||
private double mLayoutCount = 0.0;
|
||||
private double mLayoutTimer = 0.0;
|
||||
|
||||
public UIImplementation(ReactApplicationContext reactContext, List<ViewManager> viewManagers) {
|
||||
this(reactContext, new ViewManagerRegistry(viewManagers));
|
||||
}
|
||||
@@ -146,6 +149,14 @@ public class UIImplementation {
|
||||
}
|
||||
}
|
||||
|
||||
public double getLayoutCount() {
|
||||
return mLayoutCount;
|
||||
}
|
||||
|
||||
public double getLayoutTimer() {
|
||||
return mLayoutTimer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by React to create a new node with a given tag, class name and properties.
|
||||
*/
|
||||
@@ -739,10 +750,13 @@ public class UIImplementation {
|
||||
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "cssRoot.calculateLayout")
|
||||
.arg("rootTag", cssRoot.getReactTag())
|
||||
.flush();
|
||||
double startTime = (double) System.nanoTime();
|
||||
try {
|
||||
cssRoot.calculateLayout(mLayoutContext);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
mLayoutTimer = mLayoutTimer + ((double)System.nanoTime() - startTime)/ 1000000000.0;
|
||||
mLayoutCount = mLayoutCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user