Add payload size to performance stats event

Summary: Payload size is useful to understand how much data is going down the wire for frame updates.

Reviewed By: LukeDefeo

Differential Revision: D45114582

fbshipit-source-id: d0c2a01deb84a67017db88bd396b4859e08d0037
This commit is contained in:
Lorenzo Blasa
2023-04-20 09:11:55 -07:00
committed by Facebook GitHub Bot
parent 22e28a4f3e
commit 8cd2bb97bf
2 changed files with 15 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ function formatDiff(ms: number): string {
return `${ms.toFixed(0)}ms`;
}
function formatSize(bytes: number): string {
return `${(bytes / 1000).toFixed()}`;
}
const columns: DataTableColumn<PerformanceStatsEvent>[] = [
{
key: 'txId',
@@ -91,4 +95,14 @@ const columns: DataTableColumn<PerformanceStatsEvent>[] = [
return formatDiff(row.socketMS);
},
},
{
key: 'payloadSize',
title: 'Payload Size (KB)',
onRender: (row: PerformanceStatsEvent) => {
if (!row.payloadSize) {
return 'NaN';
}
return formatSize(row.payloadSize);
},
},
];

View File

@@ -85,6 +85,7 @@ export type PerformanceStatsEvent = {
deferredComputationMS: number;
serializationMS: number;
socketMS: number;
payloadSize?: number;
};
export type UpdateMetadataEvent = {