Skip to content

Commit 204616c

Browse files
workers-devprodlrapoport-cfdevin-ai-integration[bot]
authored
V3 Backport [#10888]: Update message for to clarify that local CPU profile is generated (#10889)
* Update profiling message * Add changeset * Fix formatting * Fix formatting in startup-profiling.test.ts Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: lrapoport-cf <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 89015e9 commit 204616c

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.changeset/shaky-sheep-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Clarify that `wrangler check startup` generates a local CPU profile

packages/wrangler/src/__tests__/startup-profiling.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("wrangler check startup", () => {
2323
await runWrangler("check startup");
2424

2525
expect(std.out).toContain(
26-
`CPU Profile written to worker-startup.cpuprofile`
26+
`CPU Profile has been written to worker-startup.cpuprofile`
2727
);
2828

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

3939
expect(std.out).toContain(
40-
`CPU Profile written to worker-startup.cpuprofile`
40+
`CPU Profile has been written to worker-startup.cpuprofile`
4141
);
4242

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

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

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

105107
expect(std.out).toContain(
106-
`CPU Profile written to worker-startup.cpuprofile`
108+
`CPU Profile has been written to worker-startup.cpuprofile`
107109
);
108110

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

137139
expect(std.out).toContain(
138-
`CPU Profile written to worker-startup.cpuprofile`
140+
`CPU Profile has been written to worker-startup.cpuprofile`
139141
);
140142

141143
await expect(

packages/wrangler/src/check/commands.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ async function checkStartupHandler(
8888
await writeFile(outfile, JSON.stringify(await cpuProfileResult));
8989

9090
log(
91-
`CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
91+
[
92+
`CPU Profile has been written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`,
93+
"",
94+
"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.",
95+
"",
96+
"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.",
97+
].join("\n")
9298
);
9399
}
94100

0 commit comments

Comments
 (0)