added metrics for snapshot

Reviewed By: lblasa

Differential Revision: D39886448

fbshipit-source-id: b229f6947d199026c6e4bdc89def6ac0a0fa9d0a
This commit is contained in:
Luke De Feo
2022-09-29 05:31:18 -07:00
committed by Facebook GitHub Bot
parent 4442c8599d
commit 78e84a0cc3
7 changed files with 25 additions and 3 deletions

View File

@@ -66,6 +66,7 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
input.txId, input.txId,
"FullScan", "FullScan",
input.scanStart, input.scanStart,
input.scanStart,
input.scanEnd, input.scanEnd,
input.scanEnd, input.scanEnd,
serializationEnd, serializationEnd,

View File

@@ -43,6 +43,7 @@ data class PerfStatsEvent(
val observerType: String, val observerType: String,
val start: Long, val start: Long,
val traversalComplete: Long, val traversalComplete: Long,
val snapshotComplete: Long,
val queuingComplete: Long, val queuingComplete: Long,
val serializationComplete: Long, val serializationComplete: Long,
val socketComplete: Long, val socketComplete: Long,

View File

@@ -81,6 +81,8 @@ abstract class TreeObserver<T> {
Log.d(LogTag, "For Observer ${this.type} Sending ${visitedNodes.size}") Log.d(LogTag, "For Observer ${this.type} Sending ${visitedNodes.size}")
val traversalCompleteTime = System.currentTimeMillis()
if (snapshotBitmap != null) { if (snapshotBitmap != null) {
@Suppress("unchecked_cast") @Suppress("unchecked_cast")
val descriptor = val descriptor =
@@ -89,10 +91,17 @@ abstract class TreeObserver<T> {
descriptor.getSnapshot(root, snapshotBitmap.bitmap) descriptor.getSnapshot(root, snapshotBitmap.bitmap)
} }
val endTimestamp = System.currentTimeMillis() val snapshotCompleteTime = System.currentTimeMillis()
context.treeObserverManager.enqueueUpdate( context.treeObserverManager.enqueueUpdate(
SubtreeUpdate( SubtreeUpdate(
type, root.nodeId(), visitedNodes, startTimestamp, endTimestamp, snapshotBitmap)) type,
root.nodeId(),
visitedNodes,
startTimestamp,
traversalCompleteTime,
snapshotCompleteTime,
snapshotBitmap))
} }
fun cleanUpRecursive() { fun cleanUpRecursive() {

View File

@@ -31,6 +31,7 @@ data class SubtreeUpdate(
val nodes: List<Node>, val nodes: List<Node>,
val startTime: Long, val startTime: Long,
val traversalCompleteTime: Long, val traversalCompleteTime: Long,
val snapshotComplete: Long,
val snapshot: BitmapPool.ReusableBitmap? val snapshot: BitmapPool.ReusableBitmap?
) )
@@ -104,6 +105,7 @@ class TreeObserverManager(val context: Context) {
observerType = treeUpdate.observerType, observerType = treeUpdate.observerType,
start = treeUpdate.startTime, start = treeUpdate.startTime,
traversalComplete = treeUpdate.traversalCompleteTime, traversalComplete = treeUpdate.traversalCompleteTime,
snapshotComplete = treeUpdate.snapshotComplete,
queuingComplete = onWorkerThread, queuingComplete = onWorkerThread,
serializationComplete = serializationEnd, serializationComplete = serializationEnd,
socketComplete = socketEnd, socketComplete = socketEnd,

View File

@@ -49,11 +49,18 @@ const columns: DataTableColumn<PerfStatsEvent>[] = [
return formatDiff(row.start, row.traversalComplete); return formatDiff(row.start, row.traversalComplete);
}, },
}, },
{
key: 'snapshotComplete',
title: 'Snapshot time (Main thread)',
onRender: (row: PerfStatsEvent) => {
return formatDiff(row.traversalComplete, row.snapshotComplete);
},
},
{ {
key: 'queuingComplete', key: 'queuingComplete',
title: 'Queuing time', title: 'Queuing time',
onRender: (row: PerfStatsEvent) => { onRender: (row: PerfStatsEvent) => {
return formatDiff(row.traversalComplete, row.queuingComplete); return formatDiff(row.snapshotComplete, row.queuingComplete);
}, },
}, },
{ {

View File

@@ -164,6 +164,7 @@ function Visualization2DNode({
top: toPx(bounds.y), top: toPx(bounds.y),
width: toPx(bounds.width), width: toPx(bounds.width),
height: toPx(bounds.height), height: toPx(bounds.height),
opacity: isSelected || isHovered ? 0.5 : 1,
backgroundColor: isSelected backgroundColor: isSelected
? theme.primaryColor ? theme.primaryColor
: isHovered : isHovered

View File

@@ -26,6 +26,7 @@ export type PerfStatsEvent = {
observerType: string; observerType: string;
start: number; start: number;
traversalComplete: number; traversalComplete: number;
snapshotComplete: number;
serializationComplete: number; serializationComplete: number;
queuingComplete: number; queuingComplete: number;
socketComplete: number; socketComplete: number;