@buoy-gg/benchmark 2.1.4-beta.2 → 2.1.4
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/lib/commonjs/benchmarking/BenchmarkComparator.js +1 -221
- package/lib/commonjs/benchmarking/BenchmarkRecorder.js +1 -497
- package/lib/commonjs/benchmarking/BenchmarkStorage.js +1 -235
- package/lib/commonjs/benchmarking/index.js +1 -83
- package/lib/commonjs/benchmarking/types.js +1 -13
- package/lib/commonjs/components/BenchmarkCompareView.js +1 -475
- package/lib/commonjs/components/BenchmarkDetailView.js +1 -346
- package/lib/commonjs/components/BenchmarkModal.js +1 -505
- package/lib/commonjs/components/BenchmarkSessionCard.js +1 -193
- package/lib/commonjs/index.js +1 -62
- package/lib/commonjs/preset.js +1 -86
- package/lib/module/benchmarking/BenchmarkComparator.js +1 -216
- package/lib/module/benchmarking/BenchmarkRecorder.js +1 -493
- package/lib/module/benchmarking/BenchmarkStorage.js +1 -227
- package/lib/module/benchmarking/index.js +1 -48
- package/lib/module/benchmarking/types.js +1 -13
- package/lib/module/components/BenchmarkCompareView.js +1 -469
- package/lib/module/components/BenchmarkDetailView.js +1 -340
- package/lib/module/components/BenchmarkModal.js +1 -499
- package/lib/module/components/BenchmarkSessionCard.js +1 -187
- package/lib/module/index.js +1 -39
- package/lib/module/preset.js +1 -81
- package/package.json +2 -2
- package/lib/typescript/benchmarking/BenchmarkComparator.d.ts.map +0 -1
- package/lib/typescript/benchmarking/BenchmarkRecorder.d.ts.map +0 -1
- package/lib/typescript/benchmarking/BenchmarkStorage.d.ts.map +0 -1
- package/lib/typescript/benchmarking/index.d.ts.map +0 -1
- package/lib/typescript/benchmarking/types.d.ts.map +0 -1
- package/lib/typescript/components/BenchmarkCompareView.d.ts.map +0 -1
- package/lib/typescript/components/BenchmarkDetailView.d.ts.map +0 -1
- package/lib/typescript/components/BenchmarkModal.d.ts.map +0 -1
- package/lib/typescript/components/BenchmarkSessionCard.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,346 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BenchmarkDetailView = BenchmarkDetailView;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
/**
|
|
14
|
-
* BenchmarkDetailView
|
|
15
|
-
*
|
|
16
|
-
* Displays detailed information about a single benchmark report.
|
|
17
|
-
* Shows all metrics, timing breakdowns, percentiles, and memory info.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Format milliseconds with appropriate precision
|
|
22
|
-
*/
|
|
23
|
-
function formatMs(ms) {
|
|
24
|
-
if (ms < 1) return `${(ms * 1000).toFixed(0)}μs`;
|
|
25
|
-
if (ms < 10) return `${ms.toFixed(2)}ms`;
|
|
26
|
-
if (ms < 100) return `${ms.toFixed(1)}ms`;
|
|
27
|
-
return `${ms.toFixed(0)}ms`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Format bytes as human-readable
|
|
32
|
-
*/
|
|
33
|
-
function formatBytes(bytes) {
|
|
34
|
-
if (bytes === null) return "N/A";
|
|
35
|
-
if (Math.abs(bytes) < 1024) return `${bytes}B`;
|
|
36
|
-
if (Math.abs(bytes) < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
|
|
37
|
-
return `${(bytes / 1024 / 1024).toFixed(2)}MB`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Format duration in human-readable form
|
|
42
|
-
*/
|
|
43
|
-
function formatDuration(ms) {
|
|
44
|
-
if (ms < 1000) return `${ms.toFixed(0)}ms`;
|
|
45
|
-
if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
|
|
46
|
-
const minutes = Math.floor(ms / 60000);
|
|
47
|
-
const seconds = (ms % 60000 / 1000).toFixed(0);
|
|
48
|
-
return `${minutes}m ${seconds}s`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Section header component
|
|
53
|
-
*/
|
|
54
|
-
function SectionHeader({
|
|
55
|
-
title
|
|
56
|
-
}) {
|
|
57
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
58
|
-
style: styles.sectionHeader,
|
|
59
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
60
|
-
style: styles.sectionTitle,
|
|
61
|
-
children: title
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Stat row component
|
|
68
|
-
*/
|
|
69
|
-
function StatRow({
|
|
70
|
-
label,
|
|
71
|
-
value,
|
|
72
|
-
highlight
|
|
73
|
-
}) {
|
|
74
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
75
|
-
style: styles.statRow,
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
|
-
style: styles.statLabel,
|
|
78
|
-
children: label
|
|
79
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
80
|
-
style: [styles.statValue, highlight && styles.statValueHighlight],
|
|
81
|
-
children: value
|
|
82
|
-
})]
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function BenchmarkDetailView({
|
|
86
|
-
report
|
|
87
|
-
}) {
|
|
88
|
-
const {
|
|
89
|
-
stats,
|
|
90
|
-
context,
|
|
91
|
-
memoryStart,
|
|
92
|
-
memoryEnd,
|
|
93
|
-
memoryDelta
|
|
94
|
-
} = report;
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
96
|
-
style: styles.container,
|
|
97
|
-
contentContainerStyle: styles.content,
|
|
98
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
99
|
-
title: "OVERVIEW"
|
|
100
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
101
|
-
style: styles.section,
|
|
102
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
103
|
-
label: "Name",
|
|
104
|
-
value: report.name
|
|
105
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
106
|
-
label: "Duration",
|
|
107
|
-
value: formatDuration(report.duration)
|
|
108
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
109
|
-
label: "Created",
|
|
110
|
-
value: new Date(report.createdAt).toLocaleString()
|
|
111
|
-
}), report.description && /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
112
|
-
label: "Description",
|
|
113
|
-
value: report.description
|
|
114
|
-
})]
|
|
115
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
116
|
-
title: "CONTEXT"
|
|
117
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
118
|
-
style: styles.section,
|
|
119
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
120
|
-
label: "Platform",
|
|
121
|
-
value: context.platform.toUpperCase()
|
|
122
|
-
}), context.osVersion && /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
123
|
-
label: "OS Version",
|
|
124
|
-
value: context.osVersion
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
126
|
-
label: "Dev Mode",
|
|
127
|
-
value: context.isDev ? "Yes" : "No"
|
|
128
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
129
|
-
label: "Batch Size",
|
|
130
|
-
value: context.batchSize.toString()
|
|
131
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
132
|
-
label: "Render Count",
|
|
133
|
-
value: context.showRenderCount ? "Enabled" : "Disabled"
|
|
134
|
-
})]
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
136
|
-
title: "BATCH STATISTICS"
|
|
137
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
138
|
-
style: styles.section,
|
|
139
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
140
|
-
label: "Total Batches",
|
|
141
|
-
value: stats.batchCount.toString()
|
|
142
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
143
|
-
label: "Nodes Received",
|
|
144
|
-
value: stats.totalNodesReceived.toLocaleString()
|
|
145
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
146
|
-
label: "Nodes Filtered",
|
|
147
|
-
value: stats.totalNodesFiltered.toLocaleString()
|
|
148
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
149
|
-
label: "Nodes Processed",
|
|
150
|
-
value: stats.totalNodesProcessed.toLocaleString()
|
|
151
|
-
})]
|
|
152
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
153
|
-
title: "TIMING (avg per batch)"
|
|
154
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
155
|
-
style: styles.section,
|
|
156
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
157
|
-
label: "Filter Time",
|
|
158
|
-
value: formatMs(stats.avgFilterTime)
|
|
159
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
160
|
-
label: "Measure Time",
|
|
161
|
-
value: formatMs(stats.avgMeasureTime),
|
|
162
|
-
highlight: true
|
|
163
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
164
|
-
label: "Track Time",
|
|
165
|
-
value: formatMs(stats.avgTrackTime)
|
|
166
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
167
|
-
label: "Callback Time",
|
|
168
|
-
value: formatMs(stats.avgCallbackTime)
|
|
169
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
170
|
-
style: styles.divider
|
|
171
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
172
|
-
label: "Total Pipeline",
|
|
173
|
-
value: formatMs(stats.avgTotalTime),
|
|
174
|
-
highlight: true
|
|
175
|
-
})]
|
|
176
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
177
|
-
title: "TIMING DISTRIBUTION"
|
|
178
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
179
|
-
style: styles.section,
|
|
180
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
181
|
-
label: "Min",
|
|
182
|
-
value: formatMs(stats.minTotalTime)
|
|
183
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
184
|
-
label: "P50 (Median)",
|
|
185
|
-
value: formatMs(stats.p50TotalTime)
|
|
186
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
187
|
-
label: "P95",
|
|
188
|
-
value: formatMs(stats.p95TotalTime),
|
|
189
|
-
highlight: true
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
191
|
-
label: "P99",
|
|
192
|
-
value: formatMs(stats.p99TotalTime)
|
|
193
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
194
|
-
label: "Max",
|
|
195
|
-
value: formatMs(stats.maxTotalTime)
|
|
196
|
-
})]
|
|
197
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
198
|
-
title: "OVERLAY RENDERING"
|
|
199
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
200
|
-
style: styles.section,
|
|
201
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
202
|
-
label: "Avg Render Time",
|
|
203
|
-
value: formatMs(stats.avgOverlayRenderTime)
|
|
204
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
205
|
-
label: "Avg Highlights",
|
|
206
|
-
value: stats.avgHighlightsPerRender.toFixed(1)
|
|
207
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
208
|
-
label: "Total Renders",
|
|
209
|
-
value: report.overlayRenders.length.toString()
|
|
210
|
-
})]
|
|
211
|
-
}), (memoryStart || memoryEnd) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
212
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
213
|
-
title: "MEMORY"
|
|
214
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
215
|
-
style: styles.section,
|
|
216
|
-
children: [memoryStart?.usedJSHeapSize != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
217
|
-
label: "Start Used",
|
|
218
|
-
value: formatBytes(memoryStart.usedJSHeapSize)
|
|
219
|
-
}), memoryEnd?.usedJSHeapSize != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
220
|
-
label: "End Used",
|
|
221
|
-
value: formatBytes(memoryEnd.usedJSHeapSize)
|
|
222
|
-
}), memoryDelta != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
223
|
-
label: "Delta",
|
|
224
|
-
value: `${memoryDelta >= 0 ? "+" : ""}${formatBytes(memoryDelta)}`,
|
|
225
|
-
highlight: Math.abs(memoryDelta) > 1024 * 1024
|
|
226
|
-
})]
|
|
227
|
-
})]
|
|
228
|
-
}), report.marks.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
229
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
230
|
-
title: `CUSTOM MARKS (${report.marks.length})`
|
|
231
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
232
|
-
style: styles.section,
|
|
233
|
-
children: [report.marks.slice(0, 10).map((mark, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
234
|
-
label: mark.name,
|
|
235
|
-
value: formatMs(mark.startTime)
|
|
236
|
-
}, index)), report.marks.length > 10 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
237
|
-
style: styles.moreText,
|
|
238
|
-
children: ["+", report.marks.length - 10, " more marks"]
|
|
239
|
-
})]
|
|
240
|
-
})]
|
|
241
|
-
}), report.measures.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
242
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SectionHeader, {
|
|
243
|
-
title: `CUSTOM MEASURES (${report.measures.length})`
|
|
244
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
245
|
-
style: styles.section,
|
|
246
|
-
children: [report.measures.slice(0, 10).map((measure, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(StatRow, {
|
|
247
|
-
label: measure.name,
|
|
248
|
-
value: formatMs(measure.duration)
|
|
249
|
-
}, index)), report.measures.length > 10 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
250
|
-
style: styles.moreText,
|
|
251
|
-
children: ["+", report.measures.length - 10, " more measures"]
|
|
252
|
-
})]
|
|
253
|
-
})]
|
|
254
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
255
|
-
style: styles.reportId,
|
|
256
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
257
|
-
style: styles.reportIdLabel,
|
|
258
|
-
children: "Report ID"
|
|
259
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
260
|
-
style: styles.reportIdValue,
|
|
261
|
-
children: report.id
|
|
262
|
-
})]
|
|
263
|
-
})]
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
const styles = _reactNative.StyleSheet.create({
|
|
267
|
-
container: {
|
|
268
|
-
flex: 1
|
|
269
|
-
},
|
|
270
|
-
content: {
|
|
271
|
-
paddingVertical: 16
|
|
272
|
-
},
|
|
273
|
-
sectionHeader: {
|
|
274
|
-
paddingHorizontal: 16,
|
|
275
|
-
paddingVertical: 8,
|
|
276
|
-
backgroundColor: _sharedUi.macOSColors.background.hover,
|
|
277
|
-
borderTopWidth: 1,
|
|
278
|
-
borderBottomWidth: 1,
|
|
279
|
-
borderColor: _sharedUi.macOSColors.border.default,
|
|
280
|
-
marginTop: 8
|
|
281
|
-
},
|
|
282
|
-
sectionTitle: {
|
|
283
|
-
fontSize: 11,
|
|
284
|
-
fontWeight: "600",
|
|
285
|
-
color: _sharedUi.macOSColors.text.secondary,
|
|
286
|
-
fontFamily: "monospace",
|
|
287
|
-
letterSpacing: 1
|
|
288
|
-
},
|
|
289
|
-
section: {
|
|
290
|
-
paddingHorizontal: 16,
|
|
291
|
-
paddingVertical: 8
|
|
292
|
-
},
|
|
293
|
-
statRow: {
|
|
294
|
-
flexDirection: "row",
|
|
295
|
-
justifyContent: "space-between",
|
|
296
|
-
alignItems: "center",
|
|
297
|
-
paddingVertical: 6
|
|
298
|
-
},
|
|
299
|
-
statLabel: {
|
|
300
|
-
fontSize: 13,
|
|
301
|
-
color: _sharedUi.macOSColors.text.secondary,
|
|
302
|
-
fontFamily: "monospace"
|
|
303
|
-
},
|
|
304
|
-
statValue: {
|
|
305
|
-
fontSize: 13,
|
|
306
|
-
color: _sharedUi.macOSColors.text.primary,
|
|
307
|
-
fontFamily: "monospace",
|
|
308
|
-
fontWeight: "500"
|
|
309
|
-
},
|
|
310
|
-
statValueHighlight: {
|
|
311
|
-
color: _sharedUi.macOSColors.semantic.info,
|
|
312
|
-
fontWeight: "600"
|
|
313
|
-
},
|
|
314
|
-
divider: {
|
|
315
|
-
height: 1,
|
|
316
|
-
backgroundColor: _sharedUi.macOSColors.border.default,
|
|
317
|
-
marginVertical: 8
|
|
318
|
-
},
|
|
319
|
-
moreText: {
|
|
320
|
-
fontSize: 11,
|
|
321
|
-
color: _sharedUi.macOSColors.text.muted,
|
|
322
|
-
fontFamily: "monospace",
|
|
323
|
-
fontStyle: "italic",
|
|
324
|
-
textAlign: "center",
|
|
325
|
-
paddingTop: 8
|
|
326
|
-
},
|
|
327
|
-
reportId: {
|
|
328
|
-
paddingHorizontal: 16,
|
|
329
|
-
paddingVertical: 16,
|
|
330
|
-
borderTopWidth: 1,
|
|
331
|
-
borderColor: _sharedUi.macOSColors.border.default,
|
|
332
|
-
marginTop: 16
|
|
333
|
-
},
|
|
334
|
-
reportIdLabel: {
|
|
335
|
-
fontSize: 10,
|
|
336
|
-
color: _sharedUi.macOSColors.text.muted,
|
|
337
|
-
fontFamily: "monospace",
|
|
338
|
-
marginBottom: 4
|
|
339
|
-
},
|
|
340
|
-
reportIdValue: {
|
|
341
|
-
fontSize: 10,
|
|
342
|
-
color: _sharedUi.macOSColors.text.muted,
|
|
343
|
-
fontFamily: "monospace"
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
var _default = exports.default = BenchmarkDetailView;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BenchmarkDetailView=BenchmarkDetailView,exports.default=void 0;var _react=_interopRequireDefault(require("react")),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function formatMs(e){return e<1?`${(1e3*e).toFixed(0)}μs`:e<10?`${e.toFixed(2)}ms`:e<100?`${e.toFixed(1)}ms`:`${e.toFixed(0)}ms`}function formatBytes(e){return null===e?"N/A":Math.abs(e)<1024?`${e}B`:Math.abs(e)<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(2)}MB`}function formatDuration(e){return e<1e3?`${e.toFixed(0)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}function SectionHeader({title:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionHeader,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:e})})}function StatRow({label:e,value:t,highlight:a}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statLabel,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statValue,a&&styles.statValueHighlight],children:t})]})}function BenchmarkDetailView({report:e}){const{stats:t,context:a,memoryStart:s,memoryEnd:i,memoryDelta:l}=e;return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.content,children:[(0,_jsxRuntime.jsx)(SectionHeader,{title:"OVERVIEW"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Name",value:e.name}),(0,_jsxRuntime.jsx)(StatRow,{label:"Duration",value:formatDuration(e.duration)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Created",value:new Date(e.createdAt).toLocaleString()}),e.description&&(0,_jsxRuntime.jsx)(StatRow,{label:"Description",value:e.description})]}),(0,_jsxRuntime.jsx)(SectionHeader,{title:"CONTEXT"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Platform",value:a.platform.toUpperCase()}),a.osVersion&&(0,_jsxRuntime.jsx)(StatRow,{label:"OS Version",value:a.osVersion}),(0,_jsxRuntime.jsx)(StatRow,{label:"Dev Mode",value:a.isDev?"Yes":"No"}),(0,_jsxRuntime.jsx)(StatRow,{label:"Batch Size",value:a.batchSize.toString()}),(0,_jsxRuntime.jsx)(StatRow,{label:"Render Count",value:a.showRenderCount?"Enabled":"Disabled"})]}),(0,_jsxRuntime.jsx)(SectionHeader,{title:"BATCH STATISTICS"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Total Batches",value:t.batchCount.toString()}),(0,_jsxRuntime.jsx)(StatRow,{label:"Nodes Received",value:t.totalNodesReceived.toLocaleString()}),(0,_jsxRuntime.jsx)(StatRow,{label:"Nodes Filtered",value:t.totalNodesFiltered.toLocaleString()}),(0,_jsxRuntime.jsx)(StatRow,{label:"Nodes Processed",value:t.totalNodesProcessed.toLocaleString()})]}),(0,_jsxRuntime.jsx)(SectionHeader,{title:"TIMING (avg per batch)"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Filter Time",value:formatMs(t.avgFilterTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Measure Time",value:formatMs(t.avgMeasureTime),highlight:!0}),(0,_jsxRuntime.jsx)(StatRow,{label:"Track Time",value:formatMs(t.avgTrackTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Callback Time",value:formatMs(t.avgCallbackTime)}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(StatRow,{label:"Total Pipeline",value:formatMs(t.avgTotalTime),highlight:!0})]}),(0,_jsxRuntime.jsx)(SectionHeader,{title:"TIMING DISTRIBUTION"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Min",value:formatMs(t.minTotalTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"P50 (Median)",value:formatMs(t.p50TotalTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"P95",value:formatMs(t.p95TotalTime),highlight:!0}),(0,_jsxRuntime.jsx)(StatRow,{label:"P99",value:formatMs(t.p99TotalTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Max",value:formatMs(t.maxTotalTime)})]}),(0,_jsxRuntime.jsx)(SectionHeader,{title:"OVERLAY RENDERING"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(StatRow,{label:"Avg Render Time",value:formatMs(t.avgOverlayRenderTime)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Avg Highlights",value:t.avgHighlightsPerRender.toFixed(1)}),(0,_jsxRuntime.jsx)(StatRow,{label:"Total Renders",value:e.overlayRenders.length.toString()})]}),(s||i)&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(SectionHeader,{title:"MEMORY"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[null!=s?.usedJSHeapSize&&(0,_jsxRuntime.jsx)(StatRow,{label:"Start Used",value:formatBytes(s.usedJSHeapSize)}),null!=i?.usedJSHeapSize&&(0,_jsxRuntime.jsx)(StatRow,{label:"End Used",value:formatBytes(i.usedJSHeapSize)}),null!=l&&(0,_jsxRuntime.jsx)(StatRow,{label:"Delta",value:`${l>=0?"+":""}${formatBytes(l)}`,highlight:Math.abs(l)>1048576})]})]}),e.marks.length>0&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(SectionHeader,{title:`CUSTOM MARKS (${e.marks.length})`}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[e.marks.slice(0,10).map((e,t)=>(0,_jsxRuntime.jsx)(StatRow,{label:e.name,value:formatMs(e.startTime)},t)),e.marks.length>10&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreText,children:["+",e.marks.length-10," more marks"]})]})]}),e.measures.length>0&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(SectionHeader,{title:`CUSTOM MEASURES (${e.measures.length})`}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[e.measures.slice(0,10).map((e,t)=>(0,_jsxRuntime.jsx)(StatRow,{label:e.name,value:formatMs(e.duration)},t)),e.measures.length>10&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.moreText,children:["+",e.measures.length-10," more measures"]})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.reportId,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reportIdLabel,children:"Report ID"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.reportIdValue,children:e.id})]})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1},content:{paddingVertical:16},sectionHeader:{paddingHorizontal:16,paddingVertical:8,backgroundColor:_sharedUi.macOSColors.background.hover,borderTopWidth:1,borderBottomWidth:1,borderColor:_sharedUi.macOSColors.border.default,marginTop:8},sectionTitle:{fontSize:11,fontWeight:"600",color:_sharedUi.macOSColors.text.secondary,fontFamily:"monospace",letterSpacing:1},section:{paddingHorizontal:16,paddingVertical:8},statRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:6},statLabel:{fontSize:13,color:_sharedUi.macOSColors.text.secondary,fontFamily:"monospace"},statValue:{fontSize:13,color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace",fontWeight:"500"},statValueHighlight:{color:_sharedUi.macOSColors.semantic.info,fontWeight:"600"},divider:{height:1,backgroundColor:_sharedUi.macOSColors.border.default,marginVertical:8},moreText:{fontSize:11,color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace",fontStyle:"italic",textAlign:"center",paddingTop:8},reportId:{paddingHorizontal:16,paddingVertical:16,borderTopWidth:1,borderColor:_sharedUi.macOSColors.border.default,marginTop:16},reportIdLabel:{fontSize:10,color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace",marginBottom:4},reportIdValue:{fontSize:10,color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace"}});var _default=exports.default=BenchmarkDetailView;
|