Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Total Connection Time to the Request Details Dialog #1765

Merged
merged 4 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions www/pagestyle2.css
Original file line number Diff line number Diff line change
Expand Up @@ -5688,6 +5688,12 @@ div.request-dialog-radio {
.request-details a {
word-break: break-all;
}
.request-details h3{
margin-bottom: 0;
margin-top: .5em;
text-decoration: underline;
font-size: 1em;
}

.jqmWindow {
display: none;
Expand Down
35 changes: 24 additions & 11 deletions www/waterfall.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function SelectRequest(step, request) {
}
if (wptRequestData[stepLabel][request - 1] !== undefined) {
var r = wptRequestData[stepLabel][request - 1];
var totalConnectionTime = 0;
json = JSON.stringify(r, null, 4);
const PRIORITY_MAP = {
'VeryHigh': 'Highest',
Expand All @@ -121,6 +122,7 @@ function SelectRequest(step, request) {
}
if (r['documentURL'] !== undefined)
details += '<b>Document: </b>' + htmlEncode(r['documentURL']) + '<br>';
details += '<h3>Request</h3>';
if (r['host'] !== undefined)
details += '<b>Host: </b>' + htmlEncode(r['host']) + '<br>';
experiment += '<li><a href="#" data-block-domain="' + htmlEncode(r['host']) + '">Block Request Domain</a></li>';
Expand Down Expand Up @@ -158,52 +160,63 @@ function SelectRequest(step, request) {
details += '<b>Request ID: </b>' + htmlEncode(r['request_id']) + '<br>';
if (r['client_port'] !== undefined && r['client_port'] !== null && r['client_port'])
details += '<b>Client Port: </b>' + htmlEncode(r['client_port']) + '<br>';
if (r['renderBlocking'] !== undefined) {
details += '<b>Render Blocking Status: </b>' + htmlEncode(r['renderBlocking']) + '<br>';

if (r['renderBlocking']=== 'blocking') {
experiment += '</ul><ul class="experiments"><li><a href="#" data-spof="' + htmlEncode(r['host']) + '">Run a <abbr title="Single Point of Failure">SPOF</abbr> Test (Runs in a new tab)</a></li>';
}
}
details += '<h3>Timing</h3>';
if (r['created'] !== undefined)
details += '<b>Discovered: </b>' + (r['created'] / 1000.0).toFixed(3) + ' s<br>';
if (r['load_start'] !== undefined)
details += '<b>Request Start: </b>' + (r['load_start'] / 1000.0).toFixed(3) + ' s<br>';
if (IsValidDuration(r['dns_ms'])) {
details += '<b>DNS Lookup: </b>' + htmlEncode(r['dns_ms']) + ' ms<br>';
totalConnectionTime += Number(r['dns_ms']);
} else if( r['dns_end'] !== undefined && r['dns_start'] !== undefined && r['dns_end'] > 0 ) {
var dnsTime = r['dns_end'] - r['dns_start'];
totalConnectionTime+= Number(dnsTime);
details += '<b>DNS Lookup: </b>' + dnsTime + ' ms<br>';
}
if (IsValidDuration(r['connect_ms'])) {
details += '<b>Initial Connection: </b>' + htmlEncode(r['connect_ms']) + ' ms<br>';
totalConnectionTime+= Number(r['connect_ms']);
if (r['is_secure'] !== undefined && r['is_secure'] && IsValidDuration(r['ssl_ms'])) {
details += '<b>SSL Negotiation: </b>' + htmlEncode(r['ssl_ms']) + ' ms<br>';
totalConnectionTime+= Number(r['ssl_ms']);
}
} else if( r['connect_end'] !== undefined && r['connect_start'] !== undefined && r['connect_end'] > 0 ) {
var connectTime = r['connect_end'] - r['connect_start'];
totalConnectionTime+= Number(connectTime);
details += '<b>Initial Connection: </b>' + connectTime + ' ms<br>';
if( r['ssl_end'] !== undefined && r['ssl_start'] !== undefined && r['ssl_end'] > 0 ) {
var sslTime = r['ssl_end'] - r['ssl_start'];
totalConnectionTime+= Number(r['sslTime']);
details += '<b>SSL Negotiation: </b>' + sslTime + ' ms<br>';
}
}
if (typeof totalConnectionTime === 'number' && !Number.isNaN(totalConnectionTime) && totalConnectionTime > 0) {
details += '<b>Total Connection Time: </b>' + htmlEncode(totalConnectionTime) + ' ms<br>';
}
if (IsValidDuration(r['ttfb_ms'])) {
details += '<b>Time to First Byte: </b>' + htmlEncode(r['ttfb_ms']) + ' ms<br>';
}
if (IsValidDuration(r['download_ms']))
details += '<b>Content Download: </b>' + htmlEncode(r['download_ms']) + ' ms<br>';
if (r['cpuTime'] !== undefined && r['cpuTime'] > 0)
details += '<b>CPU Time: </b>' + r['cpuTime'] + ' ms<br>';
details += '<h3>Size</h3>';

if (r['bytesIn'] !== undefined)
details += '<b>Bytes In (downloaded): </b>' + NumBytesAsDisplayString(r['bytesIn']) + '<br>';
if (r['objectSizeUncompressed'] !== undefined)
details += '<b>Uncompressed Size: </b>' + NumBytesAsDisplayString(r['objectSizeUncompressed']) + '<br>';
if (r['certificate_bytes'] !== undefined && r['certificate_bytes'] > 0)
details += '<b>Certificates (downloaded): </b>' + r['certificate_bytes'] + ' B<br>';
if (r['bytesOut'] !== undefined)
details += '<b>Bytes Out (uploaded): </b>' + NumBytesAsDisplayString(r['bytesOut']) + '<br>';
if (r['cpuTime'] !== undefined && r['cpuTime'] > 0)
details += '<b>CPU Time: </b>' + r['cpuTime'] + ' ms<br>';
if (r['renderBlocking'] !== undefined) {
details += '<b>Render Blocking Status: </b>' + htmlEncode(r['renderBlocking']) + '<br>';

if (r['renderBlocking']=== 'blocking') {
experiment += '</ul><ul class="experiments"><li><a href="#" data-spof="' + htmlEncode(r['host']) + '">Run a <abbr title="Single Point of Failure">SPOF</abbr> Test (Runs in a new tab)</a></li>';
}
}

details += '<b>Bytes Out (uploaded): </b>' + NumBytesAsDisplayString(r['bytesOut']) + '<br>';

var psPageData = wptPageData[stepLabel] !== undefined ? wptPageData[stepLabel]['psPageData'] : undefined;
if (psPageData !== undefined &&
Expand Down