forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarker-styles.js
217 lines (207 loc) · 4.49 KB
/
marker-styles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
import * as colors from 'photon-colors';
import type { CssPixels, Marker } from 'firefox-profiler/types';
type MarkerStyle = {|
+top: CssPixels,
+height: CssPixels,
+background: string,
+squareCorners: boolean,
+borderLeft: null | string,
+borderRight: null | string,
|};
const defaultStyle = {
top: 0,
height: 6,
background: 'black',
squareCorners: false,
borderLeft: null,
borderRight: null,
};
const gcStyle = {
...defaultStyle,
top: 6,
background: colors.ORANGE_50,
};
const ccStyle = {
...gcStyle,
// This is a paler orange to distinguish CC from GC.
background: '#ffc600',
};
/**
* Get the marker style. Start off by looking at the marker name, then fallback to
* the marker type.
*/
export function getMarkerStyle(marker: Marker): MarkerStyle {
const { data, name } = marker;
if (name in markerStyles) {
return markerStyles[name];
}
if (data && data.type in markerStyles) {
return markerStyles[data.type];
}
return markerStyles.default;
}
const markerStyles: { +[styleName: string]: MarkerStyle } = {
default: defaultStyle,
RefreshDriverTick: {
...defaultStyle,
background: 'hsla(0,0%,0%,0.05)',
height: 18,
squareCorners: true,
},
RD: {
...defaultStyle,
background: 'hsla(0,0%,0%,0.05)',
height: 18,
squareCorners: true,
},
// Scripts is renamed to 'requestAnimationFrame callbacks' but keeping this
// here for backwards compatibility.
Scripts: {
...defaultStyle,
background: colors.ORANGE_70,
top: 6,
},
'requestAnimationFrame callbacks': {
...defaultStyle,
background: colors.ORANGE_70,
top: 6,
},
Styles: {
...defaultStyle,
background: colors.TEAL_50,
top: 7,
},
FireScrollEvent: {
...defaultStyle,
background: colors.ORANGE_70,
top: 7,
},
Reflow: {
...defaultStyle,
background: colors.BLUE_50,
top: 7,
},
DispatchSynthMouseMove: {
...defaultStyle,
background: colors.ORANGE_70,
top: 8,
},
DisplayList: {
...defaultStyle,
background: colors.PURPLE_50,
top: 9,
},
LayerBuilding: {
...defaultStyle,
background: colors.ORANGE_50,
top: 9,
},
Rasterize: {
...defaultStyle,
background: colors.GREEN_50,
top: 10,
},
ForwardTransaction: {
...defaultStyle,
background: colors.RED_70,
top: 11,
},
NotifyDidPaint: {
...defaultStyle,
background: colors.GREY_40,
top: 12,
},
LayerTransaction: {
...defaultStyle,
background: colors.RED_70,
},
Composite: {
...defaultStyle,
background: colors.BLUE_50,
},
Vsync: {
...defaultStyle,
background: 'rgb(255, 128, 0)',
},
LayerContentGPU: {
...defaultStyle,
background: 'rgba(0,200,0,0.5)',
},
LayerCompositorGPU: {
...defaultStyle,
background: 'rgba(0,200,0,0.5)',
},
LayerOther: {
...defaultStyle,
background: 'rgb(200,0,0)',
},
Jank: {
...defaultStyle,
background: 'hsl(347, 100%, 60%)',
borderLeft: colors.RED_50,
borderRight: colors.RED_50,
squareCorners: true,
},
// BHR markers are displayed in the timeline only if jank markers are
// unavailable. Let's style them like Jank markers.
'BHR-detected hang': {
...defaultStyle,
background: 'hsl(347, 100%, 60%)',
borderLeft: colors.RED_50,
borderRight: colors.RED_50,
squareCorners: true,
},
// Memory:
GCMajor: {
...gcStyle,
squareCorners: true,
top: 0,
},
GCSlice: gcStyle,
GCMinor: gcStyle,
'GC Interrupt': gcStyle,
CC: {
...ccStyle,
squareCorners: true,
top: 0,
},
CCSlice: ccStyle,
ForgetSkippable: ccStyle,
// Note: these Idle* markers have been removed in Firefox 99 (Bug 1752646),
// but they're still here for compatibility for older profiles.
IdleCCSlice: ccStyle,
IdleForgetSkippable: ccStyle,
// IO:
FileIO: {
...defaultStyle,
background: colors.BLUE_50,
},
IPCOut: {
...defaultStyle,
background: colors.BLUE_50,
top: 2,
},
SyncIPCOut: {
...defaultStyle,
background: colors.BLUE_70,
top: 6,
},
IPCIn: {
...defaultStyle,
background: colors.PURPLE_40,
top: 13,
},
SyncIPCIn: {
...defaultStyle,
background: colors.PURPLE_70,
top: 17,
},
};
export const overlayFills = {
HOVERED: 'hsla(0,0%,100%,0.3)',
PRESSED: 'rgba(0,0,0,0.3)',
};