OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 * @param {!SDK.ServerTiming} serverTiming | 266 * @param {!SDK.ServerTiming} serverTiming |
267 * @param {number} right | 267 * @param {number} right |
268 */ | 268 */ |
269 function addTiming(serverTiming, right) { | 269 function addTiming(serverTiming, right) { |
270 var colorGenerator = new PerfUI.FlameChart.ColorGenerator({min: 0, max: 36 0, count: 36}, {min: 50, max: 80}, 80); | 270 var colorGenerator = new PerfUI.FlameChart.ColorGenerator({min: 0, max: 36 0, count: 36}, {min: 50, max: 80}, 80); |
271 var isTotal = serverTiming.metric.toLowerCase() === 'total'; | 271 var isTotal = serverTiming.metric.toLowerCase() === 'total'; |
272 var tr = tableElement.createChild('tr', isTotal ? 'network-timing-footer' : ''); | 272 var tr = tableElement.createChild('tr', isTotal ? 'network-timing-footer' : ''); |
273 var metric = tr.createChild('td', 'network-timing-metric'); | 273 var metric = tr.createChild('td', 'network-timing-metric'); |
274 metric.createTextChild(serverTiming.description || serverTiming.metric); | 274 metric.createTextChild(serverTiming.description || serverTiming.metric); |
275 var row = tr.createChild('td').createChild('div', 'network-timing-row'); | 275 var row = tr.createChild('td').createChild('div', 'network-timing-row'); |
276 var left = scale * (endTime - startTime - serverTiming.value); | 276 var serverTimingValue = serverTiming.value / 1000; // Server Timing values are in ms |
allada
2017/02/11 06:21:58
serverTiming.value may be null. This should have b
paulirish
2017/02/12 01:16:13
true.
are you OK with caseq's suggestion below? I
allada
2017/02/13 16:57:33
Yes. I am mostly worried about the fact that the J
paulirish
2017/02/13 22:18:46
sounds good. The regex can end up returning an und
| |
277 if (serverTiming.value && left >= 0) { // don't chart values too big or t oo small | 277 var left = scale * (endTime - startTime - serverTimingValue); |
278 if (serverTimingValue && left >= 0) { // don't chart values too big or to o small | |
caseq
2017/02/11 01:05:18
can we rather have everything that depens on serve
paulirish
2017/02/13 22:18:46
yup, done.
| |
278 var bar = row.createChild('span', 'network-timing-bar server-timing'); | 279 var bar = row.createChild('span', 'network-timing-bar server-timing'); |
279 bar.style.left = left + '%'; | 280 bar.style.left = left + '%'; |
280 bar.style.right = right + '%'; | 281 bar.style.right = right + '%'; |
281 bar.textContent = '\u200B'; // Important for 0-time items to have 0 wid th. | 282 bar.textContent = '\u200B'; // Important for 0-time items to have 0 wid th. |
282 if (!isTotal) | 283 if (!isTotal) |
283 bar.style.backgroundColor = colorGenerator.colorForID(serverTiming.met ric); | 284 bar.style.backgroundColor = colorGenerator.colorForID(serverTiming.met ric); |
284 } | 285 } |
285 var label = tr.createChild('td').createChild('div', 'network-timing-bar-ti tle'); | 286 var label = tr.createChild('td').createChild('div', 'network-timing-bar-ti tle'); |
286 if (typeof serverTiming.value === 'number') // a metric timing value is o ptional | 287 if (typeof serverTimingValue === 'number') // a metric timing value is op tional |
287 label.textContent = Number.secondsToString(serverTiming.value, true); | 288 label.textContent = Number.secondsToString(serverTimingValue, true); |
allada
2017/02/11 06:21:58
I suggest using Number.millisToString and not do t
paulirish
2017/02/12 01:16:13
Was originally going to do that but the rest of th
allada
2017/02/13 16:57:33
In this case, I think it'd be better to use millis
paulirish
2017/02/13 22:18:46
sg, done.
| |
288 } | 289 } |
289 | 290 |
290 /** | 291 /** |
291 * param {string} title | 292 * param {string} title |
292 */ | 293 */ |
293 function createHeader(title) { | 294 function createHeader(title) { |
294 var dataHeader = tableElement.createChild('tr', 'network-timing-table-head er'); | 295 var dataHeader = tableElement.createChild('tr', 'network-timing-table-head er'); |
295 dataHeader.createChild('td').createTextChild(title); | 296 dataHeader.createChild('td').createTextChild(title); |
296 dataHeader.createChild('td').createTextChild(''); | 297 dataHeader.createChild('td').createTextChild(''); |
297 dataHeader.createChild('td').createTextChild(Common.UIString('TIME')); | 298 dataHeader.createChild('td').createTextChild(Common.UIString('TIME')); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 }; | 347 }; |
347 | 348 |
348 Network.RequestTimingView.ConnectionSetupRangeNames = new Set([ | 349 Network.RequestTimingView.ConnectionSetupRangeNames = new Set([ |
349 Network.RequestTimeRangeNames.Queueing, Network.RequestTimeRangeNames.Blocking , | 350 Network.RequestTimeRangeNames.Queueing, Network.RequestTimeRangeNames.Blocking , |
350 Network.RequestTimeRangeNames.Connecting, Network.RequestTimeRangeNames.DNS, N etwork.RequestTimeRangeNames.Proxy, | 351 Network.RequestTimeRangeNames.Connecting, Network.RequestTimeRangeNames.DNS, N etwork.RequestTimeRangeNames.Proxy, |
351 Network.RequestTimeRangeNames.SSL | 352 Network.RequestTimeRangeNames.SSL |
352 ]); | 353 ]); |
353 | 354 |
354 /** @typedef {{name: !Network.RequestTimeRangeNames, start: number, end: number} } */ | 355 /** @typedef {{name: !Network.RequestTimeRangeNames, start: number, end: number} } */ |
355 Network.RequestTimeRange; | 356 Network.RequestTimeRange; |
OLD | NEW |