Add tracing to when SO libraries are loaded

Summary:
Currently, loading SO libraries is pretty expensive. While they are triggered due to accessing `ReadableNativeArray`. However, with preloader experiments, this block seems to move around and is loaded when the first dependent class loads it.

Also, as a part of D10108380, this will be moved again.

Adding a trace to keep track of where it moves.

Reviewed By: achen1

Differential Revision: D9890280

fbshipit-source-id: 4b331ef1d7e824935bf3708442537349d2d631d0
This commit is contained in:
Ram N 2018-10-01 13:41:49 -07:00 committed by Facebook Github Bot
parent 9e6522374b
commit ee74135a46
1 changed files with 5 additions and 0 deletions

View File

@ -7,7 +7,10 @@
package com.facebook.react.bridge;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import com.facebook.soloader.SoLoader;
import com.facebook.systrace.Systrace;
public class ReactBridge {
private static boolean sDidInit = false;
@ -15,8 +18,10 @@ public class ReactBridge {
// No locking required here, worst case we'll call into SoLoader twice
// which will do its own locking internally
if (!sDidInit) {
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni");
SoLoader.loadLibrary("reactnativejni");
sDidInit = true;
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
}
}