@playcanvas/inspector 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -4
- package/package.json +1 -1
- package/src/entity-inspector-script.js +10 -0
- package/src/frame-graph-view.js +40 -9
- package/src/inspector.js +555 -24
- package/src/node-model.js +3 -2
- package/src/perf-capture.js +2034 -0
- package/src/perf-chart.js +3989 -0
- package/src/perf-copy.js +367 -0
- package/src/perf-view.js +1224 -0
- package/src/property-view.js +3 -0
- package/src/styles.js +179 -1
- package/types/entity-inspector-script.d.ts +8 -0
- package/types/frame-graph-view.d.ts +7 -0
- package/types/inspector.d.ts +199 -5
- package/types/perf-capture.d.ts +871 -0
- package/types/perf-chart.d.ts +1407 -0
- package/types/perf-copy.d.ts +61 -0
- package/types/perf-view.d.ts +231 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** @import { PerfCapture, PerfLoad } from './perf-capture.js' */
|
|
2
|
+
/**
|
|
3
|
+
* The series a chart, or a section under the charts, copies: the figures of each frame, by the
|
|
4
|
+
* name they are copied under and the channel they are read from.
|
|
5
|
+
*
|
|
6
|
+
* @type {Record<string, [string, string][]>}
|
|
7
|
+
*/
|
|
8
|
+
export const SERIES: Record<string, [string, string][]>;
|
|
9
|
+
/**
|
|
10
|
+
* The whole capture, or a span of it: a header and every frame.
|
|
11
|
+
*
|
|
12
|
+
* @param {PerfCapture} capture - The capture.
|
|
13
|
+
* @param {number} from - The first frame.
|
|
14
|
+
* @param {number} to - The last frame, inclusive.
|
|
15
|
+
* @param {object} [device] - What to say about the device.
|
|
16
|
+
* @returns {object} The capture.
|
|
17
|
+
*/
|
|
18
|
+
export function captureJson(capture: PerfCapture, from: number, to: number, device?: object): object;
|
|
19
|
+
/**
|
|
20
|
+
* Everything recorded for a frame. Durations are in milliseconds, memory in bytes; a figure the
|
|
21
|
+
* engine did not provide is left out.
|
|
22
|
+
*
|
|
23
|
+
* The start of the app, when the capture began with it, has how long it lasted, what loaded and
|
|
24
|
+
* the moments in it, with times from the page opening.
|
|
25
|
+
*
|
|
26
|
+
* @param {PerfCapture} capture - The capture.
|
|
27
|
+
* @param {number} seq - A kept frame.
|
|
28
|
+
* @returns {object} The frame.
|
|
29
|
+
*/
|
|
30
|
+
export function frameJson(capture: PerfCapture, seq: number): object;
|
|
31
|
+
/**
|
|
32
|
+
* The figures of frames selected together: their averages, 95th percentiles and largest.
|
|
33
|
+
*
|
|
34
|
+
* @param {PerfCapture} capture - The capture.
|
|
35
|
+
* @param {number} from - The first frame.
|
|
36
|
+
* @param {number} to - The last frame, inclusive.
|
|
37
|
+
* @returns {object} The figures.
|
|
38
|
+
*/
|
|
39
|
+
export function rangeJson(capture: PerfCapture, from: number, to: number): object;
|
|
40
|
+
/**
|
|
41
|
+
* The series of a chart or section, a row per frame: the frame and its figures. The GPU series
|
|
42
|
+
* has a column per pass, the scripts series a column per script type and only the frames that
|
|
43
|
+
* timed scripts, the counters series a column per counter and only the frames that set one, the
|
|
44
|
+
* events series lists only the frames that had events, with what happened by kind, and the
|
|
45
|
+
* loading series has a row per asset, request and moment, in the frame it ended in.
|
|
46
|
+
*
|
|
47
|
+
* @param {PerfCapture} capture - The capture.
|
|
48
|
+
* @param {string} key - The chart or section: 'frame', 'cpu', 'gpu', 'draws', 'scripts',
|
|
49
|
+
* 'counters', 'loading', 'memory', 'resources' or 'events'.
|
|
50
|
+
* @param {number} from - The first frame.
|
|
51
|
+
* @param {number} to - The last frame, inclusive.
|
|
52
|
+
* @returns {object[]} The rows.
|
|
53
|
+
*/
|
|
54
|
+
export function seriesRows(capture: PerfCapture, key: string, from: number, to: number): object[];
|
|
55
|
+
/**
|
|
56
|
+
* @param {object[]} rows - Rows of the same kind, as {@link seriesRows} makes them.
|
|
57
|
+
* @returns {string} The rows as CSV, with a header of every column any row has, in the order
|
|
58
|
+
* they first appear.
|
|
59
|
+
*/
|
|
60
|
+
export function toCsv(rows: object[]): string;
|
|
61
|
+
import type { PerfCapture } from './perf-capture.js';
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
export type PerfPart = object;
|
|
2
|
+
export type PerfRangeStats = object;
|
|
3
|
+
export type PerfSelection = object;
|
|
4
|
+
export type PerfScriptLegend = object;
|
|
5
|
+
export type PerfEventKind = object;
|
|
6
|
+
export const ASSET_COLOR: "#8e8e93";
|
|
7
|
+
export const ASSET_COLORS: {
|
|
8
|
+
[k: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export const ASSET_KINDS: {
|
|
11
|
+
name: string;
|
|
12
|
+
color: string;
|
|
13
|
+
types: string[];
|
|
14
|
+
}[];
|
|
15
|
+
/** @import { PerfCapture, PerfEvent, PerfGpuPass, PerfLoad } from './perf-capture.js' */
|
|
16
|
+
/** @import { Described } from './describe.js' */
|
|
17
|
+
/** @import { PropertyRow, PropertySection } from './model.js' */
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {object} PerfPart
|
|
20
|
+
* @ignore
|
|
21
|
+
* @property {string} key - A key unique among the parts.
|
|
22
|
+
* @property {string} name - The display name.
|
|
23
|
+
* @property {string} color - The CSS color it is drawn in.
|
|
24
|
+
* @property {string} channel - The channel of the capture holding it, which the charts read
|
|
25
|
+
* directly: a call per bar would box every figure it returns.
|
|
26
|
+
* @property {string} [tip] - What it covers.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {object} PerfRangeStats
|
|
30
|
+
* @ignore
|
|
31
|
+
* @property {number} count - How many frames had the figure.
|
|
32
|
+
* @property {number} avg - The mean.
|
|
33
|
+
* @property {number} p95 - The 95th percentile.
|
|
34
|
+
* @property {number} max - The largest.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {object} PerfSelection
|
|
38
|
+
* @ignore
|
|
39
|
+
* @property {PerfCapture} capture - The capture.
|
|
40
|
+
* @property {number} seq - The frame shown, or -1 for none.
|
|
41
|
+
* @property {{ from: number, to: number }|null} range - The frames selected together, inclusive,
|
|
42
|
+
* or null.
|
|
43
|
+
* @property {{ supported: boolean, enabled: boolean, enable: () => void }} gpu - The GPU profiler:
|
|
44
|
+
* whether the device has one, whether it is on, and how to turn it on.
|
|
45
|
+
* @property {{ enabled: boolean, enable: () => void, rows?: number, pinned?: ReadonlySet<string>, pin?: (name: string) => void }} [scripts] - Script
|
|
46
|
+
* timing: whether it is on and how to turn it on; how many of the longest script types the
|
|
47
|
+
* Scripts chart gives a band of their own, besides those pinned; the names of those pinned; and
|
|
48
|
+
* how to pin or unpin one.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {object} PerfScriptLegend
|
|
52
|
+
* @ignore
|
|
53
|
+
* @property {{ id: number, name: string, color: string, pinned: boolean }[]} types - The script
|
|
54
|
+
* types with a band of their own in the Scripts chart, top down: those pinned, then the longest of
|
|
55
|
+
* the others, each by its index into {@link PerfCapture#scriptNames}.
|
|
56
|
+
* @property {Map<number, string>} colors - The color of each of them, by id.
|
|
57
|
+
* @property {number} others - How many more types took time, sharing one band.
|
|
58
|
+
* @property {string} signature - The types in order, telling when the bands change.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* The main-thread CPU time of a frame, part by part, bottom up as the CPU chart stacks them. They
|
|
62
|
+
* add up to the update and the render, which hold the rest.
|
|
63
|
+
*
|
|
64
|
+
* @type {PerfPart[]}
|
|
65
|
+
*/
|
|
66
|
+
export const CPU_PARTS: PerfPart[];
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {object} PerfEventKind
|
|
69
|
+
* @ignore
|
|
70
|
+
* @property {string} key - A key unique among the kinds.
|
|
71
|
+
* @property {string} name - The display name.
|
|
72
|
+
* @property {string} [short] - The name beside the charts, where the display name is too long.
|
|
73
|
+
* @property {string} color - The CSS color its marks are drawn in.
|
|
74
|
+
* @property {string} tip - What it marks.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* What the events of a frame can be, each a row of its own under the charts.
|
|
78
|
+
*
|
|
79
|
+
* @type {PerfEventKind[]}
|
|
80
|
+
*/
|
|
81
|
+
export const EVENT_KINDS: PerfEventKind[];
|
|
82
|
+
export const FAILED_COLOR: "#ff453a";
|
|
83
|
+
export const HITCH_FACTOR: 2;
|
|
84
|
+
export const MAIN_THREAD_COLOR: "#ff2d92";
|
|
85
|
+
export const MILESTONE_COLOR: "#e5e5ea";
|
|
86
|
+
export const OTHER_SCRIPTS_COLOR: "#8e8e93";
|
|
87
|
+
/**
|
|
88
|
+
* The render phases a profiler or debug engine times, part of the render.
|
|
89
|
+
*
|
|
90
|
+
* @type {[string, string][]}
|
|
91
|
+
*/
|
|
92
|
+
export const RENDER_PHASES: [string, string][];
|
|
93
|
+
export const REQUEST_COLOR: "#64d2ff";
|
|
94
|
+
export const SCRIPT_COLORS: string[];
|
|
95
|
+
export const SCRIPT_ROWS: 10;
|
|
96
|
+
/**
|
|
97
|
+
* Builds the property view sections for the frames selected in a capture: the range, when frames
|
|
98
|
+
* are selected together, then everything recorded for the frame shown.
|
|
99
|
+
*
|
|
100
|
+
* @param {PerfSelection} selection - The selection.
|
|
101
|
+
* @returns {PropertySection[]} The sections.
|
|
102
|
+
*/
|
|
103
|
+
export function buildPerfModel(selection: PerfSelection): PropertySection[];
|
|
104
|
+
/**
|
|
105
|
+
* @param {number} n - A count of calls, or their mean over frames.
|
|
106
|
+
* @returns {string} The count, with a decimal for a mean that is not whole.
|
|
107
|
+
*/
|
|
108
|
+
export function callCount(n: number): string;
|
|
109
|
+
/**
|
|
110
|
+
* The typical figures of a capture, against which a frame is judged: the frame interval the app
|
|
111
|
+
* manages at best, normally the display's, and the median one.
|
|
112
|
+
*
|
|
113
|
+
* @param {PerfCapture} capture - The capture.
|
|
114
|
+
* @returns {{ budget: number, median: number }} The 5th percentile and the median frame interval,
|
|
115
|
+
* NaN while nothing is recorded.
|
|
116
|
+
*/
|
|
117
|
+
export function captureNorms(capture: PerfCapture): {
|
|
118
|
+
budget: number;
|
|
119
|
+
median: number;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} name - The profiler name of the pass running an effect, as FramePassBloom.
|
|
123
|
+
* @returns {string} The name of the effect, as Bloom.
|
|
124
|
+
*/
|
|
125
|
+
export function effectName(name: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* @param {PerfCapture} capture - The capture.
|
|
128
|
+
* @param {number} seq - A kept frame.
|
|
129
|
+
* @param {string} kind - The key of one of the {@link EVENT_KINDS}.
|
|
130
|
+
* @returns {string[]} What the frame's events of that kind were, a line each.
|
|
131
|
+
*/
|
|
132
|
+
export function eventLines(capture: PerfCapture, seq: number, kind: string): string[];
|
|
133
|
+
/**
|
|
134
|
+
* @param {number} ms - A duration in milliseconds, which can be long.
|
|
135
|
+
* @returns {string} The duration in milliseconds below a second, in seconds above.
|
|
136
|
+
*/
|
|
137
|
+
export function formatDuration(ms: number): string;
|
|
138
|
+
/**
|
|
139
|
+
* @param {PerfCapture} capture - The capture.
|
|
140
|
+
* @param {number} seq - A kept frame.
|
|
141
|
+
* @returns {number} The kinds of event the frame had, a bit per kind of {@link EVENT_KINDS} in
|
|
142
|
+
* its order.
|
|
143
|
+
*/
|
|
144
|
+
export function eventMask(capture: PerfCapture, seq: number): number;
|
|
145
|
+
/**
|
|
146
|
+
* @param {PerfCapture} capture - The capture.
|
|
147
|
+
* @param {string} kind - The key of one of the {@link EVENT_KINDS}.
|
|
148
|
+
* @returns {string} Why the browser or engine cannot report that kind of event, or an empty string
|
|
149
|
+
* when it can.
|
|
150
|
+
*/
|
|
151
|
+
export function eventUnsupported(capture: PerfCapture, kind: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* @param {number} value - A count.
|
|
154
|
+
* @returns {string} The count with thousands separators, or a dash when unknown.
|
|
155
|
+
*/
|
|
156
|
+
export function formatCount(value: number): string;
|
|
157
|
+
/**
|
|
158
|
+
* @param {number} ms - A duration in milliseconds.
|
|
159
|
+
* @returns {string} The duration, to two decimals below ten.
|
|
160
|
+
*/
|
|
161
|
+
export function formatMs(ms: number): string;
|
|
162
|
+
/**
|
|
163
|
+
* @param {number} value - A value the app counts, of a unit of its own.
|
|
164
|
+
* @returns {string} The value: a whole number as a count, others to a few digits.
|
|
165
|
+
*/
|
|
166
|
+
export function formatValue(value: number): string;
|
|
167
|
+
/**
|
|
168
|
+
* What held a frame back: the processor that was busy for most of it, the display, or neither,
|
|
169
|
+
* when the time went outside the engine.
|
|
170
|
+
*
|
|
171
|
+
* @param {PerfCapture} capture - The capture.
|
|
172
|
+
* @param {number} seq - A kept frame.
|
|
173
|
+
* @param {number} budget - The frame interval the app manages at best.
|
|
174
|
+
* @returns {string} The verdict.
|
|
175
|
+
*/
|
|
176
|
+
export function frameVerdict(capture: PerfCapture, seq: number, budget: number): string;
|
|
177
|
+
/**
|
|
178
|
+
* @param {PerfCapture} capture - The capture.
|
|
179
|
+
* @param {number} seq - A kept frame.
|
|
180
|
+
* @param {number} median - The median frame interval of the capture.
|
|
181
|
+
* @returns {boolean} Whether the frame took far longer than the median frame.
|
|
182
|
+
*/
|
|
183
|
+
export function isHitch(capture: PerfCapture, seq: number, median: number): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* @param {PerfLoad} load - A load.
|
|
186
|
+
* @returns {string} The color it is drawn in.
|
|
187
|
+
*/
|
|
188
|
+
export function loadColor(load: PerfLoad): string;
|
|
189
|
+
/**
|
|
190
|
+
* @param {PerfLoad} load - A load.
|
|
191
|
+
* @returns {string} What it was: an asset or a request with how long it took, its request and
|
|
192
|
+
* its size, or a moment with when it was.
|
|
193
|
+
*/
|
|
194
|
+
export function loadText(load: PerfLoad): string;
|
|
195
|
+
/**
|
|
196
|
+
* @param {PerfCapture} capture - The capture.
|
|
197
|
+
* @param {number} seq - A kept entry.
|
|
198
|
+
* @returns {number} The slot of the frame before it, or -1 where none is kept, or where the entry
|
|
199
|
+
* before it is the start of the app, which has no figures of a frame to compare with.
|
|
200
|
+
*/
|
|
201
|
+
export function previousSlot(capture: PerfCapture, seq: number): number;
|
|
202
|
+
/**
|
|
203
|
+
* @param {PerfCapture} capture - The capture.
|
|
204
|
+
* @param {string|Float64Array} key - The channel, or a ring of values like one.
|
|
205
|
+
* @param {number} from - The first frame.
|
|
206
|
+
* @param {number} to - The last frame, inclusive.
|
|
207
|
+
* @returns {PerfRangeStats} Its mean, 95th percentile and largest over the frames.
|
|
208
|
+
*/
|
|
209
|
+
export function rangeStats(capture: PerfCapture, key: string | Float64Array, from: number, to: number): PerfRangeStats;
|
|
210
|
+
/**
|
|
211
|
+
* @param {number} index - The place of a script type among those with a band of their own.
|
|
212
|
+
* @returns {string} Its color: one of {@link SCRIPT_COLORS}, shaded lighter, then darker, on each
|
|
213
|
+
* time round them.
|
|
214
|
+
*/
|
|
215
|
+
export function scriptColorAt(index: number): string;
|
|
216
|
+
/**
|
|
217
|
+
* The script types the Scripts chart gives a band of their own: those pinned, then the ones that
|
|
218
|
+
* took the longest over a span of frames, the frames selected together or the whole capture, so a
|
|
219
|
+
* selection around a spike brings forward the scripts behind it.
|
|
220
|
+
*
|
|
221
|
+
* @param {PerfCapture} capture - The capture.
|
|
222
|
+
* @param {number} from - The first frame the types are ranked over.
|
|
223
|
+
* @param {number} to - The last, inclusive.
|
|
224
|
+
* @param {number} rows - How many of the longest types get a band, besides those pinned.
|
|
225
|
+
* @param {ReadonlySet<string>} pinned - The names of the types pinned.
|
|
226
|
+
* @returns {PerfScriptLegend} The legend.
|
|
227
|
+
*/
|
|
228
|
+
export function scriptLegend(capture: PerfCapture, from: number, to: number, rows: number, pinned: ReadonlySet<string>): PerfScriptLegend;
|
|
229
|
+
import type { PropertySection } from './model.js';
|
|
230
|
+
import type { PerfCapture } from './perf-capture.js';
|
|
231
|
+
import type { PerfLoad } from './perf-capture.js';
|