Skip to content

Commit 105563d

Browse files
Merge branch 'canary' into jrl-chunking-refactor-3
2 parents b94f085 + bc15b58 commit 105563d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

packages/next/src/bin/next.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
performance.mark('next-start')
23
import '../server/require-hook'
34
import * as log from '../build/output/log'
45
import arg from 'next/dist/compiled/arg/index.js'

packages/next/src/build/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,8 @@ export async function copyTracedFiles(
19271927
serverOutputPath,
19281928
`${
19291929
moduleType
1930-
? `import path from 'path'
1930+
? `performance.mark('next-start');
1931+
import path from 'path'
19311932
import { fileURLToPath } from 'url'
19321933
import module from 'module'
19331934
const require = module.createRequire(import.meta.url)

packages/next/src/cli/next-start.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
2-
32
import '../server/lib/cpu-profile'
43
import { startServer } from '../server/lib/start-server'
54
import { getPort, printAndExit } from '../server/lib/utils'

packages/next/src/server/lib/start-server.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
if (performance.getEntriesByName('next-start').length === 0) {
2+
performance.mark('next-start')
3+
}
14
import '../next'
25
import '../node-polyfill-fetch'
36
import '../require-hook'
@@ -130,7 +133,6 @@ export async function startServer({
130133
envInfo,
131134
expFeatureInfo,
132135
}: StartServerOptions): Promise<void> {
133-
const startServerProcessStartTime = Date.now()
134136
let handlersReady = () => {}
135137
let handlersError = () => {}
136138

@@ -297,11 +299,17 @@ export async function startServer({
297299
upgradeHandler = initResult[1]
298300

299301
const startServerProcessDuration =
300-
Date.now() - startServerProcessStartTime
302+
performance.mark('next-start-end') &&
303+
performance.measure(
304+
'next-start-duration',
305+
'next-start',
306+
'next-start-end'
307+
).duration
308+
301309
const formatDurationText =
302310
startServerProcessDuration > 2000
303311
? `${Math.round(startServerProcessDuration / 100) / 10}s`
304-
: `${startServerProcessDuration}ms`
312+
: `${Math.round(startServerProcessDuration)}ms`
305313

306314
handlersReady()
307315
logStartInfo({

0 commit comments

Comments
 (0)