From fcfbc352ba50536fcd63642d8cba9216b9e8fd53 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Tue, 27 Jun 2023 04:06:17 -0700 Subject: [PATCH] Add more diagnostic info to perf stats page Summary: This will hopefully be useful for prod debugging where we have users with no data, Reviewed By: lblasa Differential Revision: D47053328 fbshipit-source-id: 37ecce885ebd93bf2ffdd67cf49cf33255dda429 --- .../ui-debugger/components/PerfStats.tsx | 40 ++++++++++++++++--- .../public/ui-debugger/components/main.tsx | 9 ++++- desktop/plugins/public/ui-debugger/index.tsx | 15 +------ desktop/plugins/public/ui-debugger/types.tsx | 16 ++++++++ 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/desktop/plugins/public/ui-debugger/components/PerfStats.tsx b/desktop/plugins/public/ui-debugger/components/PerfStats.tsx index 9f14a03b9..43c39f710 100644 --- a/desktop/plugins/public/ui-debugger/components/PerfStats.tsx +++ b/desktop/plugins/public/ui-debugger/components/PerfStats.tsx @@ -7,13 +7,32 @@ * @format */ -import {PerformanceStatsEvent, DynamicPerformanceStatsEvent} from '../types'; +import { + PerformanceStatsEvent, + DynamicPerformanceStatsEvent, + UIState, + Id, +} from '../types'; import React, {useMemo} from 'react'; -import {DataSource, DataTable, DataTableColumn} from 'flipper-plugin'; +import { + DataInspector, + DataSource, + DataTable, + DataTableColumn, + DetailSidebar, + Layout, +} from 'flipper-plugin'; export function PerfStats(props: { + uiState: UIState; + rootId?: Id; events: DataSource; }) { + const uiStateValues = Object.entries(props.uiState).map(([key, value]) => [ + key, + value.get(), + ]); + const allColumns = useMemo(() => { if (props.events.size > 0) { const row = props.events.get(0); @@ -39,10 +58,19 @@ export function PerfStats(props: { }, [props.events]); return ( - - dataSource={props.events} - columns={allColumns} - /> + + + dataSource={props.events} + columns={allColumns} + /> + + + + ); } diff --git a/desktop/plugins/public/ui-debugger/components/main.tsx b/desktop/plugins/public/ui-debugger/components/main.tsx index bd9f9e4bc..41029c25d 100644 --- a/desktop/plugins/public/ui-debugger/components/main.tsx +++ b/desktop/plugins/public/ui-debugger/components/main.tsx @@ -78,7 +78,14 @@ export function Component() { ); } - if (showPerfStats) return ; + if (showPerfStats) + return ( + + ); if (rootId == null || streamState.state === 'RetryingAfterError') { return ( diff --git a/desktop/plugins/public/ui-debugger/index.tsx b/desktop/plugins/public/ui-debugger/index.tsx index 9e4a9cf5b..a533ecc7a 100644 --- a/desktop/plugins/public/ui-debugger/index.tsx +++ b/desktop/plugins/public/ui-debugger/index.tsx @@ -27,6 +27,7 @@ import { StreamInterceptorError, StreamState, UINode, + UIState, } from './types'; import {Draft} from 'immer'; import {QueryClient, setLogger} from 'react-query'; @@ -43,20 +44,6 @@ type PendingData = { frame: FrameScanEvent | null; }; -type UIState = { - isPaused: Atom; - streamState: Atom; - searchTerm: Atom; - isContextMenuOpen: Atom; - hoveredNodes: Atom; - selectedNode: Atom; - highlightedNodes: Atom>; - focusedNode: Atom; - expandedNodes: Atom>; - visualiserWidth: Atom; - frameworkEventMonitoring: Atom>; -}; - export function plugin(client: PluginClient) { const rootId = createState(undefined); diff --git a/desktop/plugins/public/ui-debugger/types.tsx b/desktop/plugins/public/ui-debugger/types.tsx index 167245a84..1c86b1353 100644 --- a/desktop/plugins/public/ui-debugger/types.tsx +++ b/desktop/plugins/public/ui-debugger/types.tsx @@ -7,6 +7,22 @@ * @format */ +import {Atom} from 'flipper-plugin'; + +export type UIState = { + isPaused: Atom; + streamState: Atom; + searchTerm: Atom; + isContextMenuOpen: Atom; + hoveredNodes: Atom; + selectedNode: Atom; + highlightedNodes: Atom>; + focusedNode: Atom; + expandedNodes: Atom>; + visualiserWidth: Atom; + frameworkEventMonitoring: Atom>; +}; + export type StreamState = | {state: 'Ok'} | {state: 'RetryingAfterError'}