MCPcopy Create free account
hub / github.com/adobe/react-spectrum / traceSection

Function traceSection

perf/report.mjs:326–367  ·  view source on GitHub ↗
(diagnostics)

Source from the content-addressed store, hash-verified

324
325// Main-thread breakdowns of the diagnostic trace reruns, within the measured window.
326function traceSection(diagnostics) {
327 if (!diagnostics.length) {
328 return [];
329 }
330 let lines = [
331 '## Diagnostic traces',
332 '',
333 'Each trace is a separate rerun after the same warmups as the measured trials, excluded from comparisons. Times cover the renderer main thread inside the measured window (input to rendering opportunity), attributing each moment to its innermost trace event. Forced style and layout is the part of style and layout that script triggered synchronously; it is already included in those columns.',
334 '',
335 '| Scenario / arm | Window | Main thread busy | Script | Style | Layout | Forced style and layout | Paint | GC | Other | Trace |',
336 '|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---|'
337 ];
338 for (let diagnostic of diagnostics) {
339 let {summary} = diagnostic;
340 let label = `${diagnostic.scenario} / ${diagnostic.arm}`;
341 if (diagnostic.error) {
342 lines.push(
343 `| ${label} | FAILED: ${diagnostic.error.replaceAll('|', '\\|').split('\n')[0]} |||||||||| |`
344 );
345 } else if (!summary) {
346 lines.push(`| ${label} | no measurement window in trace |||||||||| ${diagnostic.file} |`);
347 } else {
348 lines.push(
349 `| ${label} | ${[
350 summary.window,
351 summary.busy,
352 summary.script,
353 summary.style,
354 summary.layout,
355 summary.forcedStyleLayout,
356 summary.paint,
357 summary.gc,
358 summary.other
359 ]
360 .map(ms)
361 .join(' | ')} | ${diagnostic.file} |`
362 );
363 }
364 }
365 lines.push('');
366 return lines;
367}
368
369const ms = value => (value === null ? 'unavailable' : `${value.toFixed(2)} ms`);
370

Callers 1

reportFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected