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.serializer(),
|
||||||
PerfStatsEvent(
|
PerfStatsEvent(
|
||||||
result.txId,
|
result.txId,
|
||||||
|
"FullScan",
|
||||||
result.scanStart,
|
result.scanStart,
|
||||||
result.scanEnd,
|
result.scanEnd,
|
||||||
result.scanEnd,
|
result.scanEnd,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ data class NativeScanEvent(val txId: Long, val nodes: List<Node>) {
|
|||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
data class PerfStatsEvent(
|
data class PerfStatsEvent(
|
||||||
val txId: Long,
|
val txId: Long,
|
||||||
|
val observerType: String,
|
||||||
val start: Long,
|
val start: Long,
|
||||||
val traversalComplete: Long,
|
val traversalComplete: Long,
|
||||||
val queuingComplete: Long,
|
val queuingComplete: Long,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class TreeObserverManager(val context: Context) {
|
|||||||
while (isActive) {
|
while (isActive) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
val observation = treeUpdates.receive()
|
val treeUpdate = treeUpdates.receive()
|
||||||
|
|
||||||
val onWorkerThread = System.currentTimeMillis()
|
val onWorkerThread = System.currentTimeMillis()
|
||||||
|
|
||||||
@@ -61,24 +61,24 @@ class TreeObserverManager(val context: Context) {
|
|||||||
val serialized =
|
val serialized =
|
||||||
Json.encodeToString(
|
Json.encodeToString(
|
||||||
SubtreeUpdateEvent.serializer(),
|
SubtreeUpdateEvent.serializer(),
|
||||||
SubtreeUpdateEvent(txId, observation.observerType, observation.nodes))
|
SubtreeUpdateEvent(txId, treeUpdate.observerType, treeUpdate.nodes))
|
||||||
|
|
||||||
val serializationEnd = System.currentTimeMillis()
|
val serializationEnd = System.currentTimeMillis()
|
||||||
|
|
||||||
context.connectionRef.connection?.send(SubtreeUpdateEvent.name, serialized)
|
context.connectionRef.connection?.send(SubtreeUpdateEvent.name, serialized)
|
||||||
val socketEnd = System.currentTimeMillis()
|
val socketEnd = System.currentTimeMillis()
|
||||||
Log.i(
|
Log.i(LogTag, "Sent event for ${treeUpdate.observerType} nodes ${treeUpdate.nodes.size}")
|
||||||
LogTag, "Sent event for ${observation.observerType} nodes ${observation.nodes.size}")
|
|
||||||
|
|
||||||
val perfStats =
|
val perfStats =
|
||||||
PerfStatsEvent(
|
PerfStatsEvent(
|
||||||
txId = txId,
|
txId = txId,
|
||||||
start = observation.startTime,
|
observerType = treeUpdate.observerType,
|
||||||
traversalComplete = observation.traversalCompleteTime,
|
start = treeUpdate.startTime,
|
||||||
|
traversalComplete = treeUpdate.traversalCompleteTime,
|
||||||
queuingComplete = onWorkerThread,
|
queuingComplete = onWorkerThread,
|
||||||
serializationComplete = serializationEnd,
|
serializationComplete = serializationEnd,
|
||||||
socketComplete = socketEnd,
|
socketComplete = socketEnd,
|
||||||
nodesCount = observation.nodes.size)
|
nodesCount = treeUpdate.nodes.size)
|
||||||
context.connectionRef.connection?.send(
|
context.connectionRef.connection?.send(
|
||||||
PerfStatsEvent.name, Json.encodeToString(PerfStatsEvent.serializer(), perfStats))
|
PerfStatsEvent.name, Json.encodeToString(PerfStatsEvent.serializer(), perfStats))
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ export const columns: DataTableColumn<PerfStatsEvent>[] = [
|
|||||||
key: 'txId',
|
key: 'txId',
|
||||||
title: 'TXID',
|
title: 'TXID',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'observerType',
|
||||||
|
title: 'Type',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'nodesCount',
|
key: 'nodesCount',
|
||||||
title: 'Total nodes',
|
title: 'Total nodes',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {Id, UINode} from './types';
|
|||||||
|
|
||||||
export type PerfStatsEvent = {
|
export type PerfStatsEvent = {
|
||||||
txId: number;
|
txId: number;
|
||||||
|
observerType: string;
|
||||||
start: number;
|
start: number;
|
||||||
traversalComplete: number;
|
traversalComplete: number;
|
||||||
serializationComplete: number;
|
serializationComplete: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user