File tree 4 files changed +14
-5
lines changed
4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
+ performance . mark ( 'next-start' )
2
3
import '../server/require-hook'
3
4
import * as log from '../build/output/log'
4
5
import arg from 'next/dist/compiled/arg/index.js'
Original file line number Diff line number Diff line change @@ -1927,7 +1927,8 @@ export async function copyTracedFiles(
1927
1927
serverOutputPath ,
1928
1928
`${
1929
1929
moduleType
1930
- ? `import path from 'path'
1930
+ ? `performance.mark('next-start');
1931
+ import path from 'path'
1931
1932
import { fileURLToPath } from 'url'
1932
1933
import module from 'module'
1933
1934
const require = module.createRequire(import.meta.url)
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
-
3
2
import '../server/lib/cpu-profile'
4
3
import { startServer } from '../server/lib/start-server'
5
4
import { getPort , printAndExit } from '../server/lib/utils'
Original file line number Diff line number Diff line change
1
+ if ( performance . getEntriesByName ( 'next-start' ) . length === 0 ) {
2
+ performance . mark ( 'next-start' )
3
+ }
1
4
import '../next'
2
5
import '../node-polyfill-fetch'
3
6
import '../require-hook'
@@ -130,7 +133,6 @@ export async function startServer({
130
133
envInfo,
131
134
expFeatureInfo,
132
135
} : StartServerOptions ) : Promise < void > {
133
- const startServerProcessStartTime = Date . now ( )
134
136
let handlersReady = ( ) => { }
135
137
let handlersError = ( ) => { }
136
138
@@ -297,11 +299,17 @@ export async function startServer({
297
299
upgradeHandler = initResult [ 1 ]
298
300
299
301
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
+
301
309
const formatDurationText =
302
310
startServerProcessDuration > 2000
303
311
? `${ Math . round ( startServerProcessDuration / 100 ) / 10 } s`
304
- : `${ startServerProcessDuration } ms`
312
+ : `${ Math . round ( startServerProcessDuration ) } ms`
305
313
306
314
handlersReady ( )
307
315
logStartInfo ( {
You can’t perform that action at this time.
0 commit comments