@@ -7,6 +7,7 @@ import * as Host from '../../core/host/host.js';
77import * as i18n from '../../core/i18n/i18n.js' ;
88import type * as SDK from '../../core/sdk/sdk.js' ;
99import * as Logs from '../../models/logs/logs.js' ;
10+ import * as Network from '../../panels/network/network.js' ;
1011
1112import {
1213 AiAgent ,
@@ -180,22 +181,54 @@ export function formatHeaders(title: string, headers: SDK.NetworkRequest.NameVal
180181}
181182
182183export function formatNetworkRequestTiming ( request : SDK . NetworkRequest . NetworkRequest ) : string {
183- const timing = request . timing ;
184-
185- return `Request start time: ${ request . startTime }
186- Request end time: ${ request . endTime }
187- Receiving response headers start time: ${ timing ?. receiveHeadersStart }
188- Receiving response headers end time: ${ timing ?. receiveHeadersEnd }
189- Proxy negotiation start time: ${ timing ?. proxyStart }
190- Proxy negotiation end time: ${ timing ?. proxyEnd }
191- DNS lookup start time: ${ timing ?. dnsStart }
192- DNS lookup end time: ${ timing ?. dnsEnd }
193- TCP start time: ${ timing ?. connectStart }
194- TCP end time: ${ timing ?. connectEnd }
195- SSL start time: ${ timing ?. sslStart }
196- SSL end time: ${ timing ?. sslEnd }
197- Sending start: ${ timing ?. sendStart }
198- Sending end: ${ timing ?. sendEnd } ` ;
184+ const calculator = Network . NetworkPanel . NetworkPanel . instance ( ) . networkLogView . timeCalculator ( ) ;
185+ const results =
186+ Network . RequestTimingView . RequestTimingView . calculateRequestTimeRanges ( request , calculator . minimumBoundary ( ) ) ;
187+
188+ function getDuration ( name : string ) : string | undefined {
189+ const result = results . find ( r => r . name === name ) ;
190+ if ( ! result ) {
191+ return ;
192+ }
193+ return i18n . TimeUtilities . secondsToString ( result . end - result . start , true ) ;
194+ }
195+
196+ const labels = [
197+ {
198+ label : 'Queued at (timestamp)' ,
199+ value : calculator . formatValue ( request . issueTime ( ) , 2 ) ,
200+ } ,
201+ {
202+ label : 'Started at (timestamp)' ,
203+ value : calculator . formatValue ( request . startTime , 2 ) ,
204+ } ,
205+ {
206+ label : 'Queueing (duration)' ,
207+ value : getDuration ( 'queueing' ) ,
208+ } ,
209+ {
210+ label : 'Connection start (stalled) (duration)' ,
211+ value : getDuration ( 'blocking' ) ,
212+ } ,
213+ {
214+ label : 'Request sent (duration)' ,
215+ value : getDuration ( 'sending' ) ,
216+ } ,
217+ {
218+ label : 'Waiting for server response (duration)' ,
219+ value : getDuration ( 'waiting' ) ,
220+ } ,
221+ {
222+ label : 'Content download (duration)' ,
223+ value : getDuration ( 'receiving' ) ,
224+ } ,
225+ {
226+ label : 'Duration (duration)' ,
227+ value : getDuration ( 'total' ) ,
228+ } ,
229+ ] ;
230+
231+ return labels . filter ( label => Boolean ( label . value ) ) . map ( label => `${ label . label } : ${ label . value } ` ) . join ( '\n' ) ;
199232}
200233
201234function formatRequestInitiated (
0 commit comments