diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/NativeScanScheduler.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/NativeScanScheduler.kt index eb71128d5..695e0e67f 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/NativeScanScheduler.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/NativeScanScheduler.kt @@ -57,6 +57,7 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task { PerfStatsEvent.serializer(), PerfStatsEvent( result.txId, + "FullScan", result.scanStart, result.scanEnd, result.scanEnd, diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/model/Events.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/model/Events.kt index 54b91acef..dd5de8c78 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/model/Events.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/model/Events.kt @@ -32,6 +32,7 @@ data class NativeScanEvent(val txId: Long, val nodes: List) { @kotlinx.serialization.Serializable data class PerfStatsEvent( val txId: Long, + val observerType: String, val start: Long, val traversalComplete: Long, val queuingComplete: Long, diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/observers/TreeObserver.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/observers/TreeObserver.kt index 88ad2b3a8..e451e0861 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/observers/TreeObserver.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/observers/TreeObserver.kt @@ -53,7 +53,7 @@ class TreeObserverManager(val context: Context) { while (isActive) { try { - val observation = treeUpdates.receive() + val treeUpdate = treeUpdates.receive() val onWorkerThread = System.currentTimeMillis() @@ -61,24 +61,24 @@ class TreeObserverManager(val context: Context) { val serialized = Json.encodeToString( SubtreeUpdateEvent.serializer(), - SubtreeUpdateEvent(txId, observation.observerType, observation.nodes)) + SubtreeUpdateEvent(txId, treeUpdate.observerType, treeUpdate.nodes)) val serializationEnd = System.currentTimeMillis() context.connectionRef.connection?.send(SubtreeUpdateEvent.name, serialized) val socketEnd = System.currentTimeMillis() - Log.i( - LogTag, "Sent event for ${observation.observerType} nodes ${observation.nodes.size}") + Log.i(LogTag, "Sent event for ${treeUpdate.observerType} nodes ${treeUpdate.nodes.size}") val perfStats = PerfStatsEvent( txId = txId, - start = observation.startTime, - traversalComplete = observation.traversalCompleteTime, + observerType = treeUpdate.observerType, + start = treeUpdate.startTime, + traversalComplete = treeUpdate.traversalCompleteTime, queuingComplete = onWorkerThread, serializationComplete = serializationEnd, socketComplete = socketEnd, - nodesCount = observation.nodes.size) + nodesCount = treeUpdate.nodes.size) context.connectionRef.connection?.send( PerfStatsEvent.name, Json.encodeToString(PerfStatsEvent.serializer(), perfStats)) } catch (e: java.lang.Exception) { diff --git a/desktop/plugins/public/ui-debugger/components/main.tsx b/desktop/plugins/public/ui-debugger/components/main.tsx index f4dcd23b9..f00c6e64c 100644 --- a/desktop/plugins/public/ui-debugger/components/main.tsx +++ b/desktop/plugins/public/ui-debugger/components/main.tsx @@ -58,6 +58,10 @@ export const columns: DataTableColumn[] = [ key: 'txId', title: 'TXID', }, + { + key: 'observerType', + title: 'Type', + }, { key: 'nodesCount', title: 'Total nodes', diff --git a/desktop/plugins/public/ui-debugger/index.tsx b/desktop/plugins/public/ui-debugger/index.tsx index c104332c2..896b27d16 100644 --- a/desktop/plugins/public/ui-debugger/index.tsx +++ b/desktop/plugins/public/ui-debugger/index.tsx @@ -12,6 +12,7 @@ import {Id, UINode} from './types'; export type PerfStatsEvent = { txId: number; + observerType: string; start: number; traversalComplete: number; serializationComplete: number;