mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add thread idle indicator (#39206)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39206 Add thread idle indicator to UI, JS and native modules threads to the RN perf monitor. Changelog: [Internal] - Add thread idle state to perf monitor Reviewed By: rshest Differential Revision: D48673070 fbshipit-source-id: e121eaf2a3149f0d0605681249808fc8dfaa5010
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b15a2c3fc1
commit
5a926c5c4e
+12
@@ -441,6 +441,18 @@ public class ReactContext extends ContextWrapper {
|
||||
return Assertions.assertNotNull(mJSMessageQueueThread).runOnQueue(runnable);
|
||||
}
|
||||
|
||||
public @Nullable MessageQueueThread getJSMessageQueueThread() {
|
||||
return mJSMessageQueueThread;
|
||||
}
|
||||
|
||||
public @Nullable MessageQueueThread getNativeModulesMessageQueueThread() {
|
||||
return mNativeModulesMessageQueueThread;
|
||||
}
|
||||
|
||||
public @Nullable MessageQueueThread getUiMessageQueueThread() {
|
||||
return mUiMessageQueueThread;
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes the given exception to the current {@link JSExceptionHandler} if one exists, rethrowing
|
||||
* otherwise.
|
||||
|
||||
+4
@@ -69,4 +69,8 @@ public interface MessageQueueThread {
|
||||
*/
|
||||
@DoNotStrip
|
||||
void resetPerfStats();
|
||||
|
||||
/** Returns true if the message queue is idle */
|
||||
@DoNotStrip
|
||||
boolean isIdle();
|
||||
}
|
||||
|
||||
+6
@@ -156,6 +156,12 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
|
||||
});
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@Override
|
||||
public boolean isIdle() {
|
||||
return mLooper.getQueue().isIdle();
|
||||
}
|
||||
|
||||
private static void assignToPerfStats(MessageQueueThreadPerfStats stats, long wall, long cpu) {
|
||||
stats.wallTime = wall;
|
||||
stats.cpuTime = cpu;
|
||||
|
||||
Reference in New Issue
Block a user