Bug 1320671 - Add transferred size to the network performance view. r?
MozReview-Commit-ID: E6SdNAzw09F
--- a/devtools/client/locales/en-US/netmonitor.properties
+++ b/devtools/client/locales/en-US/netmonitor.properties
@@ -232,16 +232,20 @@ charts.cacheEnabled=Primed cache
# LOCALIZATION NOTE (charts.cacheDisabled): This is the label displayed
# in the performance analysis view for "cache disabled" charts.
charts.cacheDisabled=Empty cache
# LOCALIZATION NOTE (charts.totalSize): This is the label displayed
# in the performance analysis view for total requests size, in kilobytes.
charts.totalSize=Size: %S KB
+# LOCALIZATION NOTE (charts.totalTransferredSize): This is the label displayed
+# in the performance analysis view for total transferred requests size, in kilobytes.
+charts.totalTransferredSize=Transferred size: %S KB
+
# LOCALIZATION NOTE (charts.totalSeconds): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# This is the label displayed in the performance analysis view for the
# total requests time, in seconds.
charts.totalSeconds=Time: #1 second;Time: #1 seconds
# LOCALIZATION NOTE (charts.totalCached): This is the label displayed
# in the performance analysis view for total cached responses.
--- a/devtools/client/netmonitor/performance-statistics-view.js
+++ b/devtools/client/netmonitor/performance-statistics-view.js
@@ -92,26 +92,34 @@ PerformanceStatisticsView.prototype = {
* Common stringifier predicates used for items and totals in both the
* "primed" and "empty" cache charts.
*/
_commonChartStrings: {
size: value => {
let string = L10N.numberWithDecimals(value / 1024, CONTENT_SIZE_DECIMALS);
return L10N.getFormatStr("charts.sizeKB", string);
},
+ transferredSize: value => {
+ let string = L10N.numberWithDecimals(value / 1024, CONTENT_SIZE_DECIMALS);
+ return L10N.getFormatStr("charts.sizeKB", string);
+ },
time: value => {
let string = L10N.numberWithDecimals(value / 1000, REQUEST_TIME_DECIMALS);
return L10N.getFormatStr("charts.totalS", string);
}
},
_commonChartTotals: {
size: total => {
let string = L10N.numberWithDecimals(total / 1024, CONTENT_SIZE_DECIMALS);
return L10N.getFormatStr("charts.totalSize", string);
},
+ transferredSize: total => {
+ let string = L10N.numberWithDecimals(total / 1024, CONTENT_SIZE_DECIMALS);
+ return L10N.getFormatStr("charts.totalTransferredSize", string);
+ },
time: total => {
let seconds = total / 1000;
let string = L10N.numberWithDecimals(seconds, REQUEST_TIME_DECIMALS);
return PluralForm.get(seconds,
L10N.getStr("charts.totalSeconds")).replace("#1", string);
},
cached: total => {
return L10N.getFormatStr("charts.totalCached", total);
@@ -168,16 +176,17 @@ PerformanceStatisticsView.prototype = {
_sanitizeChartDataSource: function (items, emptyCache) {
let data = [
"html", "css", "js", "xhr", "fonts", "images", "media", "flash", "ws", "other"
].map(e => ({
cached: 0,
count: 0,
label: e,
size: 0,
+ transferredSize: 0,
time: 0
}));
for (let requestItem of items) {
let details = requestItem;
let type;
if (Filters.html(details)) {
@@ -211,16 +220,17 @@ PerformanceStatisticsView.prototype = {
} else {
// "other"
type = 9;
}
if (emptyCache || !responseIsFresh(details)) {
data[type].time += details.totalTime || 0;
data[type].size += details.contentSize || 0;
+ data[type].transferredSize += details.transferredSize || 0;
} else {
data[type].cached++;
}
data[type].count++;
}
return data.filter(e => e.count > 0);
},