From 55dd59010bb34b026046eb8f0aa1835aaad401af Mon Sep 17 00:00:00 2001 From: Andrei Kuchuk Date: Sat, 6 Jul 2024 19:32:18 +0400 Subject: [PATCH] [#37] fix errors and types in profiler call-graph --- src/entities/profiler/types.ts | 45 ++++++++++--- src/screens/profiler/types.ts | 3 - .../call-graph-toolbar/call-graph-toolbar.vue | 28 +++++---- .../profiler/ui/call-graph/call-graph.vue | 63 ++++++------------- .../ui/call-stat-board/call-stat-board.vue | 4 +- .../profiler/ui/flame-graph/flame-graph.vue | 3 +- .../ui/profiler-page/profiler-page.vue | 7 +-- src/shared/types/partials.ts | 7 --- src/shared/ui/stat-board/stat-board.vue | 2 +- src/widgets/ui/render-graph/render-graph.vue | 9 +-- 10 files changed, 85 insertions(+), 86 deletions(-) delete mode 100644 src/screens/profiler/types.ts diff --git a/src/entities/profiler/types.ts b/src/entities/profiler/types.ts index f8b4cfa2..7424bf37 100644 --- a/src/entities/profiler/types.ts +++ b/src/entities/profiler/types.ts @@ -1,3 +1,5 @@ +import {GraphTypes, type Uuid} from "~/src/shared/types"; + export interface ProfilerCost { d_cpu: number; d_wt: number; @@ -14,14 +16,6 @@ export interface ProfilerCost { p_wt: number; } -export interface ProfilerEdge { - id: string, - parent: string | null, - caller: string | null, - callee: string, - cost: ProfilerCost -} - export interface Profiler { tags: { [key: string]: string | null | number @@ -31,3 +25,38 @@ export interface Profiler { date: number, peaks: ProfilerCost, } + +export type TCallGraphEdge = { + data: { + color: string + label: string + source: string + target: string + } +} + +export type TCallGraphNode = { + data: { + id: Uuid + color: string, + cost: Partial + metrics: Partial + name: string + textColor: string + } +} + +export type TCallGraph = { + edges: TCallGraphEdge[], + nodes: TCallGraphNode[], + toolbar: { label: string; metric: GraphTypes; description: string }[], +} + + +export interface TCallGraphBoard { + edge: { + callee: string, + caller: string, + cost: Partial, + } +} diff --git a/src/screens/profiler/types.ts b/src/screens/profiler/types.ts deleted file mode 100644 index 9380eb46..00000000 --- a/src/screens/profiler/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ProfilerEdge } from "~/src/entities/profiler/types"; - -export type CallStackHoverData = ProfilerEdge & { position: { x: number; y: number } } diff --git a/src/screens/profiler/ui/call-graph-toolbar/call-graph-toolbar.vue b/src/screens/profiler/ui/call-graph-toolbar/call-graph-toolbar.vue index a979328e..7530f213 100644 --- a/src/screens/profiler/ui/call-graph-toolbar/call-graph-toolbar.vue +++ b/src/screens/profiler/ui/call-graph-toolbar/call-graph-toolbar.vue @@ -1,13 +1,14 @@ @@ -91,7 +95,7 @@ const handleChangeMetric = (event: Event) => { :min="metric === GraphTypes.CALLS ? 1 : 0" :max="metric === GraphTypes.CALLS ? 1000 : 100" :step="metric === GraphTypes.CALLS ? 10 : 5" - @input="handleChangeMetric" + @input="handlePercent" > diff --git a/src/screens/profiler/ui/call-graph/call-graph.vue b/src/screens/profiler/ui/call-graph/call-graph.vue index fd6499e9..362e0f27 100644 --- a/src/screens/profiler/ui/call-graph/call-graph.vue +++ b/src/screens/profiler/ui/call-graph/call-graph.vue @@ -1,9 +1,9 @@