Skip to content
5 changes: 5 additions & 0 deletions .changeset/shaky-sheep-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Clarify that `wrangler check startup` generates a local CPU profile
12 changes: 7 additions & 5 deletions packages/wrangler/src/__tests__/startup-profiling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("wrangler check startup", () => {
await runWrangler("check startup");

expect(std.out).toContain(
`CPU Profile written to worker-startup.cpuprofile`
`CPU Profile has been written to worker-startup.cpuprofile`
);

await expect(
Expand All @@ -37,7 +37,7 @@ describe("wrangler check startup", () => {
await runWrangler("check startup");

expect(std.out).toContain(
`CPU Profile written to worker-startup.cpuprofile`
`CPU Profile has been written to worker-startup.cpuprofile`
);

await expect(
Expand All @@ -50,7 +50,9 @@ describe("wrangler check startup", () => {

await runWrangler("check startup --outfile worker.cpuprofile");

expect(std.out).toContain(`CPU Profile written to worker.cpuprofile`);
expect(std.out).toContain(
`CPU Profile has been written to worker.cpuprofile`
);
});
test("--args passed through to deploy", async () => {
writeWranglerConfig({ main: "index.js" });
Expand Down Expand Up @@ -103,7 +105,7 @@ describe("wrangler check startup", () => {
expect(std.out).toContain(`Pages project detected`);

expect(std.out).toContain(
`CPU Profile written to worker-startup.cpuprofile`
`CPU Profile has been written to worker-startup.cpuprofile`
);

await expect(
Expand Down Expand Up @@ -135,7 +137,7 @@ describe("wrangler check startup", () => {
expect(std.out).toContain(`Pages project detected`);

expect(std.out).toContain(
`CPU Profile written to worker-startup.cpuprofile`
`CPU Profile has been written to worker-startup.cpuprofile`
);

await expect(
Expand Down
8 changes: 7 additions & 1 deletion packages/wrangler/src/check/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ async function checkStartupHandler(
await writeFile(outfile, JSON.stringify(await cpuProfileResult));

log(
`CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
[
`CPU Profile has been written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`,
"",
"Note that the CPU Profile was measured on your Worker running locally on your machine, which has a different CPU than when your Worker runs on Cloudflare.",
"",
"As such, CPU Profile can be used to understand where time is spent at startup, but the overall startup time in the profile should not be expected to exactly match what your Worker's startup time will be when deploying to Cloudflare.",
].join("\n")
);
}

Expand Down
Loading