5
5
import { Fragment , FunctionComponent , h } from 'preact' ;
6
6
import { MiddleOut } from 'vscode-js-profile-core/out/esm/client/middleOutCompression' ;
7
7
import { classes } from 'vscode-js-profile-core/out/esm/client/util' ;
8
- import { decimalFormat , getLocationText } from 'vscode-js-profile-core/out/esm/cpu/display' ;
8
+ import { getNodeText } from 'vscode-js-profile-core/out/esm/common/display' ;
9
+ import { decimalFormat } from 'vscode-js-profile-core/out/esm/cpu/display' ;
9
10
import { ILocation , IProfileModel } from 'vscode-js-profile-core/out/esm/cpu/model' ;
10
11
import { Constants } from '../common/constants' ;
11
12
import DragHandle from '../common/drag-handle' ;
12
13
import styles from '../common/flame-graph.css' ;
13
14
import StackList from '../common/stack-list' ;
14
- import { HighlightSource } from '../common/types' ;
15
+ import { HighlightSource , IBox , IColumn } from '../common/types' ;
15
16
import useFlame from '../common/use-flame' ;
16
- import { IColumn , IColumnLocation } from './stacks' ;
17
-
18
- export interface IBox {
19
- column : number ;
20
- row : number ;
21
- x1 : number ;
22
- y1 : number ;
23
- x2 : number ;
24
- y2 : number ;
25
- color : number ;
26
- level : number ;
27
- text : string ;
28
- category : number ;
29
- loc : IColumnLocation ;
30
- }
31
17
32
18
const clamp = ( min : number , v : number , max : number ) => Math . max ( Math . min ( v , max ) , min ) ;
33
19
@@ -103,7 +89,7 @@ export const FlameGraph: FunctionComponent<{
103
89
upperY = { canvasSize . height - hovered . box . y1 + bounds . y }
104
90
lowerY = { hovered . box . y2 - bounds . y }
105
91
src = { hovered . src }
106
- location = { hovered . box . loc }
92
+ location = { hovered . box . loc as ILocation }
107
93
/>
108
94
) }
109
95
{ focused && showInfo && (
@@ -128,7 +114,7 @@ const Tooltip: FunctionComponent<{
128
114
location : ILocation ;
129
115
src : HighlightSource ;
130
116
} > = ( { left, lowerY, upperY, src, location, canvasWidth, canvasHeight } ) => {
131
- const label = getLocationText ( location ) ;
117
+ const label = getNodeText ( location ) ;
132
118
const above = lowerY + 300 > canvasHeight && lowerY > canvasHeight / 2 ;
133
119
134
120
const file = label ?. split ( / \\ | \/ / g) . pop ( ) ;
@@ -183,9 +169,9 @@ const InfoBox: FunctionComponent<{
183
169
< div className = { styles . info } >
184
170
< dl >
185
171
< dt > Self Time</ dt >
186
- < dd > { decimalFormat . format ( localLocation . selfTime / 1000 ) } ms</ dd >
172
+ < dd > { decimalFormat . format ( ( localLocation as ILocation ) . selfTime / 1000 ) } ms</ dd >
187
173
< dt > Total Time</ dt >
188
- < dd > { decimalFormat . format ( localLocation . aggregateTime / 1000 ) } ms</ dd >
174
+ < dd > { decimalFormat . format ( ( localLocation as ILocation ) . aggregateTime / 1000 ) } ms</ dd >
189
175
< dt >
190
176
Self Time< small > Entire Profile</ small >
191
177
</ dt >
0 commit comments