Add observer type to Perf event
Summary: While looking at the event stream it is useful to know which observer type fired it Reviewed By: lblasa Differential Revision: D39430756 fbshipit-source-id: bc52f085a5497692f8076b12a9c015cc33a19d1e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
03121ca8b3
commit
24ec43eb92
@@ -57,6 +57,7 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
||||
PerfStatsEvent.serializer(),
|
||||
PerfStatsEvent(
|
||||
result.txId,
|
||||
"FullScan",
|
||||
result.scanStart,
|
||||
result.scanEnd,
|
||||
result.scanEnd,
|
||||
|
||||
@@ -32,6 +32,7 @@ data class NativeScanEvent(val txId: Long, val nodes: List<Node>) {
|
||||
@kotlinx.serialization.Serializable
|
||||
data class PerfStatsEvent(
|
||||
val txId: Long,
|
||||
val observerType: String,
|
||||
val start: Long,
|
||||
val traversalComplete: Long,
|
||||
val queuingComplete: Long,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -58,6 +58,10 @@ export const columns: DataTableColumn<PerfStatsEvent>[] = [
|
||||
key: 'txId',
|
||||
title: 'TXID',
|
||||
},
|
||||
{
|
||||
key: 'observerType',
|
||||
title: 'Type',
|
||||
},
|
||||
{
|
||||
key: 'nodesCount',
|
||||
title: 'Total nodes',
|
||||
|
||||
@@ -12,6 +12,7 @@ import {Id, UINode} from './types';
|
||||
|
||||
export type PerfStatsEvent = {
|
||||
txId: number;
|
||||
observerType: string;
|
||||
start: number;
|
||||
traversalComplete: number;
|
||||
serializationComplete: number;
|
||||
|
||||
Reference in New Issue
Block a user