@ogygia/devtools 0.0.0 → 0.11.1
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/LICENSE +21 -0
- package/README.md +24 -1
- package/dist/client.d.ts +3 -0
- package/dist/client.js +24 -0
- package/dist/devtools/BoundaryOverlay.svelte +396 -0
- package/dist/devtools/BoundaryOverlay.svelte.d.ts +19 -0
- package/dist/devtools/Devtools.svelte +663 -0
- package/dist/devtools/Devtools.svelte.d.ts +15 -0
- package/dist/devtools/HubTab.svelte +206 -0
- package/dist/devtools/HubTab.svelte.d.ts +11 -0
- package/dist/devtools/HydrationTab.svelte +237 -0
- package/dist/devtools/HydrationTab.svelte.d.ts +13 -0
- package/dist/devtools/IslandDetail.svelte +615 -0
- package/dist/devtools/IslandDetail.svelte.d.ts +15 -0
- package/dist/devtools/LedgerTab.svelte +287 -0
- package/dist/devtools/LedgerTab.svelte.d.ts +11 -0
- package/dist/devtools/LensTab.svelte +290 -0
- package/dist/devtools/LensTab.svelte.d.ts +19 -0
- package/dist/devtools/NavTab.svelte +229 -0
- package/dist/devtools/NavTab.svelte.d.ts +11 -0
- package/dist/devtools/PageTab.svelte +1122 -0
- package/dist/devtools/PageTab.svelte.d.ts +15 -0
- package/dist/devtools/ProfilerTab.svelte +755 -0
- package/dist/devtools/ProfilerTab.svelte.d.ts +15 -0
- package/dist/devtools/PropsTree.svelte +155 -0
- package/dist/devtools/PropsTree.svelte.d.ts +15 -0
- package/dist/devtools/SessionTab.svelte +796 -0
- package/dist/devtools/SessionTab.svelte.d.ts +11 -0
- package/dist/devtools/TimelineTab.svelte +267 -0
- package/dist/devtools/TimelineTab.svelte.d.ts +11 -0
- package/dist/devtools/WireTab.svelte +149 -0
- package/dist/devtools/WireTab.svelte.d.ts +11 -0
- package/dist/devtools/bytes.d.ts +70 -0
- package/dist/devtools/bytes.js +82 -0
- package/dist/devtools/cache-headers.d.ts +20 -0
- package/dist/devtools/cache-headers.js +81 -0
- package/dist/devtools/highlight.d.ts +7 -0
- package/dist/devtools/highlight.js +83 -0
- package/dist/devtools/hydration.d.ts +48 -0
- package/dist/devtools/hydration.js +93 -0
- package/dist/devtools/index.d.ts +3 -0
- package/dist/devtools/index.js +3 -0
- package/dist/devtools/ledger-dom.d.ts +7 -0
- package/dist/devtools/ledger-dom.js +151 -0
- package/dist/devtools/leftovers.d.ts +77 -0
- package/dist/devtools/leftovers.js +319 -0
- package/dist/devtools/names.d.ts +1 -0
- package/dist/devtools/names.js +34 -0
- package/dist/devtools/page.d.ts +96 -0
- package/dist/devtools/page.js +957 -0
- package/dist/devtools/profile-anchors.d.ts +22 -0
- package/dist/devtools/profile-anchors.js +135 -0
- package/dist/devtools/profile-store.d.ts +175 -0
- package/dist/devtools/profile-store.js +239 -0
- package/dist/devtools/regions.d.ts +77 -0
- package/dist/devtools/regions.js +132 -0
- package/dist/devtools/session.d.ts +31 -0
- package/dist/devtools/session.js +455 -0
- package/dist/devtools/since-load.d.ts +50 -0
- package/dist/devtools/since-load.js +89 -0
- package/dist/devtools/source-lines.d.ts +24 -0
- package/dist/devtools/source-lines.js +106 -0
- package/dist/devtools/styles.d.ts +52 -0
- package/dist/devtools/styles.js +248 -0
- package/dist/devtools/testing-engine.d.ts +83 -0
- package/dist/devtools/testing-engine.js +220 -0
- package/dist/devtools/ui-app.d.ts +5 -0
- package/dist/devtools/ui-app.js +69 -0
- package/dist/devtools/ui.d.ts +50 -0
- package/dist/devtools/ui.js +175 -0
- package/dist/profiler/alloc.d.ts +75 -0
- package/dist/profiler/alloc.js +76 -0
- package/dist/profiler/analyze.d.ts +437 -0
- package/dist/profiler/analyze.js +1941 -0
- package/dist/profiler/app-path.d.ts +7 -0
- package/dist/profiler/app-path.js +26 -0
- package/dist/profiler/async-io.d.ts +58 -0
- package/dist/profiler/async-io.js +187 -0
- package/dist/profiler/beacon-standalone.d.ts +4 -0
- package/dist/profiler/beacon-standalone.js +409 -0
- package/dist/profiler/browser-findings.d.ts +25 -0
- package/dist/profiler/browser-findings.js +260 -0
- package/dist/profiler/byte-strip.d.ts +58 -0
- package/dist/profiler/byte-strip.js +228 -0
- package/dist/profiler/client-files.d.ts +16 -0
- package/dist/profiler/client-files.js +60 -0
- package/dist/profiler/client-windows.d.ts +49 -0
- package/dist/profiler/client-windows.js +95 -0
- package/dist/profiler/client.d.ts +40 -0
- package/dist/profiler/client.js +82 -0
- package/dist/profiler/compare.d.ts +308 -0
- package/dist/profiler/compare.js +733 -0
- package/dist/profiler/compress.d.ts +10 -0
- package/dist/profiler/compress.js +36 -0
- package/dist/profiler/contention.d.ts +60 -0
- package/dist/profiler/contention.js +86 -0
- package/dist/profiler/crypto.d.ts +19 -0
- package/dist/profiler/crypto.js +101 -0
- package/dist/profiler/doc-diff.d.ts +47 -0
- package/dist/profiler/doc-diff.js +214 -0
- package/dist/profiler/dom-diff.d.ts +43 -0
- package/dist/profiler/dom-diff.js +121 -0
- package/dist/profiler/drill.d.ts +89 -0
- package/dist/profiler/drill.js +553 -0
- package/dist/profiler/embedded-maps.d.ts +37 -0
- package/dist/profiler/embedded-maps.js +135 -0
- package/dist/profiler/env.d.ts +6 -0
- package/dist/profiler/env.js +10 -0
- package/dist/profiler/forecast.d.ts +76 -0
- package/dist/profiler/forecast.js +225 -0
- package/dist/profiler/frames.d.ts +11 -0
- package/dist/profiler/frames.js +42 -0
- package/dist/profiler/gc.d.ts +144 -0
- package/dist/profiler/gc.js +271 -0
- package/dist/profiler/hole-slots.d.ts +31 -0
- package/dist/profiler/hole-slots.js +90 -0
- package/dist/profiler/index.d.ts +288 -0
- package/dist/profiler/index.js +4921 -0
- package/dist/profiler/insights.d.ts +96 -0
- package/dist/profiler/insights.js +239 -0
- package/dist/profiler/ledger.d.ts +121 -0
- package/dist/profiler/ledger.js +440 -0
- package/dist/profiler/lineage.d.ts +81 -0
- package/dist/profiler/lineage.js +359 -0
- package/dist/profiler/module-map.d.ts +12 -0
- package/dist/profiler/module-map.js +94 -0
- package/dist/profiler/net.d.ts +169 -0
- package/dist/profiler/net.js +586 -0
- package/dist/profiler/on-demand.d.ts +11 -0
- package/dist/profiler/on-demand.js +15 -0
- package/dist/profiler/own-requests.d.ts +9 -0
- package/dist/profiler/own-requests.js +17 -0
- package/dist/profiler/patterns.d.ts +476 -0
- package/dist/profiler/patterns.js +2203 -0
- package/dist/profiler/profiler-router.d.ts +245 -0
- package/dist/profiler/profiler-router.js +113 -0
- package/dist/profiler/refresh-stub.d.ts +2 -0
- package/dist/profiler/refresh-stub.js +37 -0
- package/dist/profiler/report.d.ts +1404 -0
- package/dist/profiler/report.js +2638 -0
- package/dist/profiler/river.d.ts +65 -0
- package/dist/profiler/river.js +298 -0
- package/dist/profiler/route-files.d.ts +22 -0
- package/dist/profiler/route-files.js +55 -0
- package/dist/profiler/route-imports.d.ts +14 -0
- package/dist/profiler/route-imports.js +83 -0
- package/dist/profiler/saving.d.ts +22 -0
- package/dist/profiler/saving.js +42 -0
- package/dist/profiler/score.d.ts +109 -0
- package/dist/profiler/score.js +261 -0
- package/dist/profiler/session-cookie.d.ts +28 -0
- package/dist/profiler/session-cookie.js +45 -0
- package/dist/profiler/sink.d.ts +81 -0
- package/dist/profiler/sink.js +124 -0
- package/dist/profiler/site-fixes.d.ts +25 -0
- package/dist/profiler/site-fixes.js +62 -0
- package/dist/profiler/source-scan.d.ts +210 -0
- package/dist/profiler/source-scan.js +1724 -0
- package/dist/profiler/span.d.ts +90 -0
- package/dist/profiler/span.js +109 -0
- package/dist/profiler/stacks.d.ts +43 -0
- package/dist/profiler/stacks.js +107 -0
- package/dist/profiler/standalone.d.ts +27 -0
- package/dist/profiler/standalone.js +98 -0
- package/dist/profiler/steps.d.ts +39 -0
- package/dist/profiler/steps.js +74 -0
- package/dist/profiler/storage/index.d.ts +87 -0
- package/dist/profiler/storage/index.js +76 -0
- package/dist/profiler/storage/postgres.d.ts +12 -0
- package/dist/profiler/storage/postgres.js +94 -0
- package/dist/profiler/storage/redis.d.ts +19 -0
- package/dist/profiler/storage/redis.js +148 -0
- package/dist/profiler/storage/sqlite.d.ts +2 -0
- package/dist/profiler/storage/sqlite.js +85 -0
- package/dist/profiler/storage/visits.d.ts +4 -0
- package/dist/profiler/storage/visits.js +6 -0
- package/dist/profiler/stream-tail.d.ts +26 -0
- package/dist/profiler/stream-tail.js +74 -0
- package/dist/profiler/timeline.d.ts +279 -0
- package/dist/profiler/timeline.js +690 -0
- package/dist/profiler/ui/AllocStrip.svelte +146 -0
- package/dist/profiler/ui/AllocStrip.svelte.d.ts +17 -0
- package/dist/profiler/ui/Awaits.svelte +363 -0
- package/dist/profiler/ui/Awaits.svelte.d.ts +16 -0
- package/dist/profiler/ui/ByteStrip.svelte +182 -0
- package/dist/profiler/ui/ByteStrip.svelte.d.ts +18 -0
- package/dist/profiler/ui/Compare.svelte +24 -0
- package/dist/profiler/ui/Compare.svelte.d.ts +16 -0
- package/dist/profiler/ui/CompareBody.svelte +429 -0
- package/dist/profiler/ui/CompareBody.svelte.d.ts +8 -0
- package/dist/profiler/ui/ComponentsTable.svelte +265 -0
- package/dist/profiler/ui/ComponentsTable.svelte.d.ts +20 -0
- package/dist/profiler/ui/Dashboard.svelte +492 -0
- package/dist/profiler/ui/Dashboard.svelte.d.ts +31 -0
- package/dist/profiler/ui/DataRiver.svelte +206 -0
- package/dist/profiler/ui/DataRiver.svelte.d.ts +13 -0
- package/dist/profiler/ui/DomTravel.svelte +207 -0
- package/dist/profiler/ui/DomTravel.svelte.d.ts +9 -0
- package/dist/profiler/ui/DownloadHtml.svelte +52 -0
- package/dist/profiler/ui/DownloadHtml.svelte.d.ts +10 -0
- package/dist/profiler/ui/Drill.svelte +276 -0
- package/dist/profiler/ui/Drill.svelte.d.ts +12 -0
- package/dist/profiler/ui/ExportButton.svelte +59 -0
- package/dist/profiler/ui/ExportButton.svelte.d.ts +8 -0
- package/dist/profiler/ui/Flame.svelte +222 -0
- package/dist/profiler/ui/Flame.svelte.d.ts +12 -0
- package/dist/profiler/ui/FrameDetails.svelte +308 -0
- package/dist/profiler/ui/FrameDetails.svelte.d.ts +16 -0
- package/dist/profiler/ui/FunctionsTable.svelte +156 -0
- package/dist/profiler/ui/FunctionsTable.svelte.d.ts +17 -0
- package/dist/profiler/ui/IslandHeatmap.svelte +151 -0
- package/dist/profiler/ui/IslandHeatmap.svelte.d.ts +16 -0
- package/dist/profiler/ui/IslandsTable.svelte +448 -0
- package/dist/profiler/ui/IslandsTable.svelte.d.ts +16 -0
- package/dist/profiler/ui/KeepLocal.svelte +46 -0
- package/dist/profiler/ui/KeepLocal.svelte.d.ts +8 -0
- package/dist/profiler/ui/Ledger.svelte +196 -0
- package/dist/profiler/ui/Ledger.svelte.d.ts +18 -0
- package/dist/profiler/ui/LocalCompare.svelte +48 -0
- package/dist/profiler/ui/LocalCompare.svelte.d.ts +8 -0
- package/dist/profiler/ui/LocalReports.svelte +68 -0
- package/dist/profiler/ui/LocalReports.svelte.d.ts +7 -0
- package/dist/profiler/ui/Login.svelte +13 -0
- package/dist/profiler/ui/Login.svelte.d.ts +12 -0
- package/dist/profiler/ui/LoginForm.svelte +42 -0
- package/dist/profiler/ui/LoginForm.svelte.d.ts +7 -0
- package/dist/profiler/ui/Message.svelte +10 -0
- package/dist/profiler/ui/Message.svelte.d.ts +12 -0
- package/dist/profiler/ui/OnThisPage.svelte +137 -0
- package/dist/profiler/ui/OnThisPage.svelte.d.ts +3 -0
- package/dist/profiler/ui/OneClock.svelte +297 -0
- package/dist/profiler/ui/OneClock.svelte.d.ts +27 -0
- package/dist/profiler/ui/Panel.svelte +10 -0
- package/dist/profiler/ui/Panel.svelte.d.ts +16 -0
- package/dist/profiler/ui/Paths.svelte +269 -0
- package/dist/profiler/ui/Paths.svelte.d.ts +15 -0
- package/dist/profiler/ui/Patterns.svelte +364 -0
- package/dist/profiler/ui/Patterns.svelte.d.ts +15 -0
- package/dist/profiler/ui/PermalinkGate.svelte +143 -0
- package/dist/profiler/ui/PermalinkGate.svelte.d.ts +10 -0
- package/dist/profiler/ui/RenderSteps.svelte +218 -0
- package/dist/profiler/ui/RenderSteps.svelte.d.ts +13 -0
- package/dist/profiler/ui/Report.svelte +28 -0
- package/dist/profiler/ui/Report.svelte.d.ts +20 -0
- package/dist/profiler/ui/ReportBody.svelte +2592 -0
- package/dist/profiler/ui/ReportBody.svelte.d.ts +21 -0
- package/dist/profiler/ui/Run.svelte +17 -0
- package/dist/profiler/ui/Run.svelte.d.ts +14 -0
- package/dist/profiler/ui/RunView.svelte +146 -0
- package/dist/profiler/ui/RunView.svelte.d.ts +10 -0
- package/dist/profiler/ui/ScoreCard.svelte +197 -0
- package/dist/profiler/ui/ScoreCard.svelte.d.ts +7 -0
- package/dist/profiler/ui/Scrub.svelte +293 -0
- package/dist/profiler/ui/Scrub.svelte.d.ts +18 -0
- package/dist/profiler/ui/SeedExplainer.svelte +193 -0
- package/dist/profiler/ui/SeedExplainer.svelte.d.ts +16 -0
- package/dist/profiler/ui/ShareLink.svelte +148 -0
- package/dist/profiler/ui/ShareLink.svelte.d.ts +8 -0
- package/dist/profiler/ui/Shell.svelte +50 -0
- package/dist/profiler/ui/Shell.svelte.d.ts +27 -0
- package/dist/profiler/ui/Sidebar.svelte +312 -0
- package/dist/profiler/ui/Sidebar.svelte.d.ts +7 -0
- package/dist/profiler/ui/Site.svelte +20 -0
- package/dist/profiler/ui/Site.svelte.d.ts +23 -0
- package/dist/profiler/ui/SiteView.svelte +385 -0
- package/dist/profiler/ui/SiteView.svelte.d.ts +27 -0
- package/dist/profiler/ui/ThemeSwitch.svelte +78 -0
- package/dist/profiler/ui/ThemeSwitch.svelte.d.ts +3 -0
- package/dist/profiler/ui/Timeline.svelte +672 -0
- package/dist/profiler/ui/Timeline.svelte.d.ts +22 -0
- package/dist/profiler/ui/Treemap.svelte +278 -0
- package/dist/profiler/ui/Treemap.svelte.d.ts +20 -0
- package/dist/profiler/ui/Upload.svelte +19 -0
- package/dist/profiler/ui/Upload.svelte.d.ts +10 -0
- package/dist/profiler/ui/UploadForm.svelte +59 -0
- package/dist/profiler/ui/UploadForm.svelte.d.ts +6 -0
- package/dist/profiler/ui/WaitingTable.svelte +55 -0
- package/dist/profiler/ui/WaitingTable.svelte.d.ts +14 -0
- package/dist/profiler/ui/Waterfall.svelte +371 -0
- package/dist/profiler/ui/Waterfall.svelte.d.ts +7 -0
- package/dist/profiler/ui/WhatIf.svelte +87 -0
- package/dist/profiler/ui/WhatIf.svelte.d.ts +18 -0
- package/dist/profiler/ui/fake-progress.svelte.d.ts +15 -0
- package/dist/profiler/ui/fake-progress.svelte.js +38 -0
- package/dist/profiler/ui/format.d.ts +20 -0
- package/dist/profiler/ui/format.js +71 -0
- package/dist/profiler/ui/permalink.d.ts +9 -0
- package/dist/profiler/ui/permalink.js +108 -0
- package/dist/profiler/ui/press.d.ts +5 -0
- package/dist/profiler/ui/press.js +19 -0
- package/dist/profiler/ui/profiler.css +650 -0
- package/dist/profiler/ui/report-data.d.ts +189 -0
- package/dist/profiler/ui/report-data.js +393 -0
- package/dist/profiler/ui/report-request.d.ts +6 -0
- package/dist/profiler/ui/report-request.js +50 -0
- package/dist/profiler/ui/row-anchor.svelte.d.ts +12 -0
- package/dist/profiler/ui/row-anchor.svelte.js +44 -0
- package/dist/profiler/ui/sort.svelte.d.ts +14 -0
- package/dist/profiler/ui/sort.svelte.js +37 -0
- package/dist/profiler/ui/store.d.ts +45 -0
- package/dist/profiler/ui/store.js +92 -0
- package/dist/profiler/visit.d.ts +389 -0
- package/dist/profiler/visit.js +1002 -0
- package/dist/report.d.ts +5 -0
- package/dist/report.js +4 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.js +38 -0
- package/dist/vite.d.ts +12 -0
- package/dist/vite.js +78 -0
- package/package.json +99 -6
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { CpuProfile, FrameCategory } from "./analyze.js";
|
|
2
|
+
export type Phase = "hooks" | "load" | "remote" | "render" | "ogygia" | "kit" | "other";
|
|
3
|
+
export declare const PHASE_LABEL: Record<Phase, string>;
|
|
4
|
+
/** The frame facts the timeline needs per profile node — what `analyze` resolved. */
|
|
5
|
+
export interface FrameInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
line: number;
|
|
9
|
+
category: FrameCategory;
|
|
10
|
+
pkg?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TimelineCall {
|
|
13
|
+
/** performance.now() ms at start */
|
|
14
|
+
start: number;
|
|
15
|
+
/** ms until done (headers + body for a fetch); < 0 = never finished */
|
|
16
|
+
ms: number;
|
|
17
|
+
/** what to call it: `GET host/path` or `timer` / `file read` */
|
|
18
|
+
label: string;
|
|
19
|
+
/** 'net' (fetch / http) or an I/O primitive kind */
|
|
20
|
+
kind: string;
|
|
21
|
+
/** the function that started it, when resolved */
|
|
22
|
+
caller?: string;
|
|
23
|
+
/** the phase of the code that started it (from the caller's file); else the wait takes the
|
|
24
|
+
* phase of whatever ran just before it */
|
|
25
|
+
phase?: Phase;
|
|
26
|
+
/** the first-party call path above the caller, resolved (`fetchStock (…)` ← `load (…)`) */
|
|
27
|
+
callers?: string[];
|
|
28
|
+
/** the upstream's own Server-Timing: what their side spent the wait on */
|
|
29
|
+
timings?: {
|
|
30
|
+
name: string;
|
|
31
|
+
ms: number;
|
|
32
|
+
desc?: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** a fetch: of `ms`, the part spent reading the body after the headers came */
|
|
35
|
+
body_ms?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface TimelineInput {
|
|
38
|
+
/** performance.now() at `Profiler.start` */
|
|
39
|
+
perf_start: number;
|
|
40
|
+
/** the request's window, performance.now() ms */
|
|
41
|
+
window: {
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
};
|
|
45
|
+
calls: TimelineCall[];
|
|
46
|
+
/** page mode: every run's window (for the per-run component split) */
|
|
47
|
+
runs?: {
|
|
48
|
+
start: number;
|
|
49
|
+
end: number;
|
|
50
|
+
}[];
|
|
51
|
+
/** every async resource the hooks saw (waits or not): a gap is named after what was pending */
|
|
52
|
+
pending?: {
|
|
53
|
+
start: number;
|
|
54
|
+
end: number;
|
|
55
|
+
label: string;
|
|
56
|
+
kind: string;
|
|
57
|
+
}[];
|
|
58
|
+
/** the app's `handle` functions that live outside the hooks file: name → file stem
|
|
59
|
+
* (source-scan `handle_parts`), so their work after `resolve()` reads as hooks, not "other":
|
|
60
|
+
* the function itself anywhere on a stack, or any code in its module on a stack nothing else
|
|
61
|
+
* claims */
|
|
62
|
+
hooks?: ReadonlyMap<string, string>;
|
|
63
|
+
/** the profiled request's Kit route id (`/latecomer`, `/(app)/p/[id]`): a sample under ANOTHER
|
|
64
|
+
* route's page or layout file is another request's work, set aside */
|
|
65
|
+
route?: string;
|
|
66
|
+
/** windows (performance.now() ms) whose samples are another visitor's as much as the profiled
|
|
67
|
+
* render's (a render of the same page overlapped): set aside by time */
|
|
68
|
+
set_aside?: {
|
|
69
|
+
start: number;
|
|
70
|
+
end: number;
|
|
71
|
+
}[];
|
|
72
|
+
}
|
|
73
|
+
/** Which call started only once another finished: the await that serialized them. */
|
|
74
|
+
export interface AwaitEdge {
|
|
75
|
+
/** the call that had to finish first */
|
|
76
|
+
from: string;
|
|
77
|
+
/** the call that started right after it */
|
|
78
|
+
to: string;
|
|
79
|
+
/** ms between the one's end and the other's start (CPU, or nothing) */
|
|
80
|
+
gap_ms: number;
|
|
81
|
+
/** where `to` was started from — the await site to look at */
|
|
82
|
+
at?: string;
|
|
83
|
+
/** the file:line chain above it, when captured */
|
|
84
|
+
callers?: string[];
|
|
85
|
+
}
|
|
86
|
+
/** One call as the causality graph draws it: a box on the render's clock, in a lane. */
|
|
87
|
+
export interface AwaitNode {
|
|
88
|
+
label: string;
|
|
89
|
+
t0: number;
|
|
90
|
+
t1: number;
|
|
91
|
+
lane: number;
|
|
92
|
+
kind: string;
|
|
93
|
+
caller?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface Segment {
|
|
96
|
+
/** ms from the window start */
|
|
97
|
+
t0: number;
|
|
98
|
+
t1: number;
|
|
99
|
+
kind: "cpu" | "wait" | "gap";
|
|
100
|
+
/** cpu: the owning component / function; wait: the call (or "N calls in parallel") */
|
|
101
|
+
label: string;
|
|
102
|
+
/** cpu: the leaf-most named frame when it differs from the owner (what inside it burned) */
|
|
103
|
+
detail?: string;
|
|
104
|
+
/** cpu: owner's `file:line` */
|
|
105
|
+
file?: string;
|
|
106
|
+
category: FrameCategory;
|
|
107
|
+
phase: Phase;
|
|
108
|
+
/** wait: every call in flight during the segment */
|
|
109
|
+
calls?: {
|
|
110
|
+
label: string;
|
|
111
|
+
ms: number;
|
|
112
|
+
caller?: string;
|
|
113
|
+
callers?: string[];
|
|
114
|
+
timings?: TimelineCall["timings"];
|
|
115
|
+
body_ms?: number;
|
|
116
|
+
}[];
|
|
117
|
+
/** the innermost `span()` this segment sits inside, when any */
|
|
118
|
+
within?: string;
|
|
119
|
+
/** cpu: the Kit load file on its stack (`routes/+page.server.ts`) — the load a helper in
|
|
120
|
+
* `$lib` ran for */
|
|
121
|
+
lane?: string;
|
|
122
|
+
/** gap: the async resources that were pending across it — what the wait most likely was */
|
|
123
|
+
pending?: string[];
|
|
124
|
+
}
|
|
125
|
+
export interface PhaseRow {
|
|
126
|
+
phase: Phase;
|
|
127
|
+
cpu_ms: number;
|
|
128
|
+
wait_ms: number;
|
|
129
|
+
/** whose CPU it was: the owners holding a tenth or more of it, biggest first (at most 3) */
|
|
130
|
+
top?: {
|
|
131
|
+
label: string;
|
|
132
|
+
ms: number;
|
|
133
|
+
}[];
|
|
134
|
+
}
|
|
135
|
+
export interface ParallelGroup {
|
|
136
|
+
/** the calls, in the order they ran */
|
|
137
|
+
calls: string[];
|
|
138
|
+
/** their summed wait */
|
|
139
|
+
ms: number;
|
|
140
|
+
/** what running them together would save (sum − longest) */
|
|
141
|
+
save_ms: number;
|
|
142
|
+
/** segment indices in `segments` */
|
|
143
|
+
at: number[];
|
|
144
|
+
}
|
|
145
|
+
/** One Kit load function's lane: when it ran, what it cost, and whether it awaited its parent. */
|
|
146
|
+
export interface LoadLane {
|
|
147
|
+
/** the load file, relative to src (`routes/hell/+page.server.ts`) */
|
|
148
|
+
file: string;
|
|
149
|
+
level: "layout" | "page" | "error";
|
|
150
|
+
/** `+page.server.ts` runs on the server only; a universal `+page.ts` runs in the browser too */
|
|
151
|
+
kind: "server" | "universal";
|
|
152
|
+
/** ms from the window start: first and last moment this load was on the CPU or waiting */
|
|
153
|
+
t0: number;
|
|
154
|
+
t1: number;
|
|
155
|
+
cpu_ms: number;
|
|
156
|
+
wait_ms: number;
|
|
157
|
+
/** Kit's `parent()` ran under this load: it awaited the layout's data before doing its own work */
|
|
158
|
+
awaited_parent: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** The page load began only after the layout load finished — Kit runs them together unless the
|
|
161
|
+
* page awaits `parent()` (or the layout's data is otherwise on its path). */
|
|
162
|
+
export interface LoadChain {
|
|
163
|
+
layout: string;
|
|
164
|
+
page: string;
|
|
165
|
+
/** how long the page's load sat behind the layout's: the most that running them together saves */
|
|
166
|
+
serial_ms: number;
|
|
167
|
+
/** a `parent()` frame was seen under the page load (else inferred from the timing alone) */
|
|
168
|
+
explicit: boolean;
|
|
169
|
+
/** from the page load's source (set at report time): its `await parent()` line, the names that
|
|
170
|
+
* sets, the first line reading one (null: none), and the awaits between that waited for nothing */
|
|
171
|
+
parent_use?: {
|
|
172
|
+
line: number;
|
|
173
|
+
names: string[];
|
|
174
|
+
first_use: number | null;
|
|
175
|
+
awaits_before_use: number;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
export interface Timeline {
|
|
179
|
+
window_ms: number;
|
|
180
|
+
/** the app's CPU inside the window (the profiler's own frames are in `overhead_ms`, not here) */
|
|
181
|
+
cpu_ms: number;
|
|
182
|
+
wait_ms: number;
|
|
183
|
+
gap_ms: number;
|
|
184
|
+
overhead_ms: number;
|
|
185
|
+
segments: Segment[];
|
|
186
|
+
phases: PhaseRow[];
|
|
187
|
+
parallelizable: ParallelGroup[];
|
|
188
|
+
/** Kit's load functions, one lane each (absent when none ran in the window) */
|
|
189
|
+
lanes?: LoadLane[];
|
|
190
|
+
chain?: LoadChain;
|
|
191
|
+
/** THE CAUSALITY GRAPH of the waits: every call as a box in a lane, and an edge wherever a
|
|
192
|
+
* call started only once another had finished (the await that serialized them) */
|
|
193
|
+
awaits?: {
|
|
194
|
+
nodes: AwaitNode[];
|
|
195
|
+
edges: AwaitEdge[];
|
|
196
|
+
};
|
|
197
|
+
/** WHAT RAN INSIDE each app owner: the deepest app function on the stack of its samples (an
|
|
198
|
+
* arrow, a callback, the owner itself), with its ms. An owner is the nearest NAMED function, so
|
|
199
|
+
* this is the only record of which of its arrows held the time. Keyed by the owner's label. */
|
|
200
|
+
inner?: Record<string, InnerFn[]>;
|
|
201
|
+
}
|
|
202
|
+
export interface InnerFn {
|
|
203
|
+
/** the function's name, `(anonymous)` for an arrow */
|
|
204
|
+
name: string;
|
|
205
|
+
/** its own start, `file:line` (short path) */
|
|
206
|
+
file: string;
|
|
207
|
+
ms: number;
|
|
208
|
+
}
|
|
209
|
+
/** The lane a load frame / caller belongs to: `{ file, level, kind }`, or null. */
|
|
210
|
+
export declare function load_lane_of(text: string): Pick<LoadLane, "file" | "level" | "kind"> | null;
|
|
211
|
+
/** The Kit phase of ONE frame, or null when the frame says nothing about it. */
|
|
212
|
+
export declare function phase_of_frame(f: FrameInfo, hooks?: ReadonlyMap<string, string>): Phase | null;
|
|
213
|
+
/** Walk a stack leaf → root; the first frame that names a phase wins (the deepest decision). */
|
|
214
|
+
export declare function phase_of_stack(frames: FrameInfo[], hooks?: ReadonlyMap<string, string>): Phase;
|
|
215
|
+
/** The frame a CPU segment is charged to: the deepest component, else the deepest named app
|
|
216
|
+
* function, else the deepest dependency, else the runtime bucket the leaf is in. */
|
|
217
|
+
export declare function owner_of_stack(frames: FrameInfo[]): {
|
|
218
|
+
label: string;
|
|
219
|
+
file: string;
|
|
220
|
+
category: FrameCategory;
|
|
221
|
+
detail?: string;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Build the timeline. `frame_of` resolves a profile node to its frame facts, `parent_of` the
|
|
225
|
+
* tree; both come from `analyze`'s own tables so the timeline agrees with every other view.
|
|
226
|
+
*/
|
|
227
|
+
export declare function build_timeline(profile: CpuProfile, frame_of: (id: number) => FrameInfo, parent_of: (id: number) => number | undefined, input: TimelineInput): Timeline;
|
|
228
|
+
/**
|
|
229
|
+
* THE CAUSALITY GRAPH: every call (net + I/O primitives, not spans) as a box on the render's
|
|
230
|
+
* clock, laid into lanes so overlapping calls sit on different rows, and an edge from a call to
|
|
231
|
+
* the one that started right after it finished while nothing else was in flight — that start
|
|
232
|
+
* waited for that end, and `at` is the line that did the waiting. Edges are what the
|
|
233
|
+
* "awaits in a row" callouts are made of; the graph shows them with the exact await site.
|
|
234
|
+
*/
|
|
235
|
+
export declare function await_graph(input: TimelineInput, w0: number, w1: number): {
|
|
236
|
+
nodes: AwaitNode[];
|
|
237
|
+
edges: AwaitEdge[];
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Awaits in a row: consecutive single-call waits on DIFFERENT calls with little CPU between them —
|
|
241
|
+
* 5 ms, or 5% of the chain's longest wait when that is more. Read off the COALESCED view
|
|
242
|
+
* (`coalesce`), where a wait chopped by microtask slivers is one block again — on the raw segments
|
|
243
|
+
* the same call reappearing after a sliver broke every chain. `at` indexes that view (the same one
|
|
244
|
+
* the UI draws).
|
|
245
|
+
*
|
|
246
|
+
* (The allowance scales: between a 1 s timer and a 700 ms call, the CPU of the server answering the
|
|
247
|
+
* page's own call to itself, or a collection, ran 3 to 9 ms run by run — the fixed 5 ms broke the
|
|
248
|
+
* chain in some runs and not others, and a 2.2 s finding came and went between two profiles of the
|
|
249
|
+
* same code. Next to waits that long, tens of ms of CPU are still nothing between.)
|
|
250
|
+
*/
|
|
251
|
+
export declare function find_parallelizable(t: Timeline): ParallelGroup[];
|
|
252
|
+
/**
|
|
253
|
+
* READABLE SEGMENTS: the sweep is exact but a render is hundreds of slivers — every card's CPU
|
|
254
|
+
* is its own owner, and a wait is chopped by every microtask that runs inside it. For the bar and
|
|
255
|
+
* the steps, fold anything below `min_ms` into its neighbours: a run of small pieces becomes ONE
|
|
256
|
+
* segment named after what dominated it (`mostly ProductCard (+11 more)`), and a wait interrupted
|
|
257
|
+
* by small CPU slices reads as one wait again. `parts` says how many raw segments a merged one
|
|
258
|
+
* holds; the raw list stays in `segments` for the tooltip's exact numbers.
|
|
259
|
+
*/
|
|
260
|
+
export interface ViewSegment extends Segment {
|
|
261
|
+
parts: number;
|
|
262
|
+
/** the raw pieces that were folded in, by label, largest first (for the tooltip) */
|
|
263
|
+
inside?: {
|
|
264
|
+
label: string;
|
|
265
|
+
kind: Segment["kind"];
|
|
266
|
+
ms: number;
|
|
267
|
+
}[];
|
|
268
|
+
}
|
|
269
|
+
export declare function coalesce(t: Timeline, min_ms?: number): ViewSegment[];
|
|
270
|
+
/** A net call's timeline label: `GET host/path` (query dropped, long paths cut). */
|
|
271
|
+
export declare function label_call(method: string, url: string): string;
|
|
272
|
+
/** The steps worth listing: every coalesced segment at or above `min_pct` of the window, in time
|
|
273
|
+
* order (`i` indexes the coalesced list). */
|
|
274
|
+
export declare function chain_steps(t: Timeline, min_pct?: number, max?: number): {
|
|
275
|
+
i: number;
|
|
276
|
+
seg: ViewSegment;
|
|
277
|
+
ms: number;
|
|
278
|
+
pct: number;
|
|
279
|
+
}[];
|