Bug 663423 - Add two more memory measurements to TelemetryPing.js. r=taras.

This commit is contained in:
Nicholas Nethercote 2011-07-04 16:16:01 +10:00
Родитель a597d20fb3
Коммит 24719f7773
2 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -39,7 +39,7 @@
/**
* This file lists Telemetry histograms collected by Firefox. The format is
*
* HISTOGRAM(id, minium, maximum, bucket count, histogram kind,
* HISTOGRAM(id, minimum, maximum, bucket count, histogram kind,
* human-readable description for about:telemetry)
*
*/
@ -53,6 +53,10 @@ HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Successful telemetry submission
HISTOGRAM(MEMORY_JS_GC_HEAP, 1024, 512 * 1024, 10, EXPONENTIAL, "Memory used by the garbage-collected JavaScript heap (KB)")
HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident memory size (KB)")
HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory used by layout (KB)")
HISTOGRAM(MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Memory used for uncompressed, in-use content images (KB)")
HISTOGRAM(MEMORY_HEAP_USED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Heap memory used (KB)")
// XXX: bug 660731 will enable this
//HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)")
#if defined(XP_WIN)
HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount before glue startup")
HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)")

Просмотреть файл

@ -57,6 +57,9 @@ const MEM_HISTOGRAMS = {
"js-gc-heap": "MEMORY_JS_GC_HEAP",
"resident": "MEMORY_RESIDENT",
"explicit/layout/all": "MEMORY_LAYOUT_ALL",
"explicit/images/content/used/uncompressed":
"MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED",
"heap-used": "MEMORY_HEAP_USED",
"hard-page-faults": "HARD_PAGE_FAULTS"
};
@ -191,6 +194,15 @@ TelemetryPing.prototype = {
_initialized: false,
_prevValues: {},
addValue: function addValue(name, id, val) {
let h = this._histograms[name];
if (!h) {
h = Telemetry.getHistogramById(id);
this._histograms[name] = h;
}
h.add(val);
},
/**
* Pull values from about:memory into corresponding histograms
*/
@ -205,7 +217,6 @@ TelemetryPing.prototype = {
}
let e = mgr.enumerateReporters();
let memReporters = {};
while (e.hasMoreElements()) {
let mr = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
let id = MEM_HISTOGRAMS[mr.path];
@ -238,15 +249,11 @@ TelemetryPing.prototype = {
NS_ASSERT(false, "Can't handle memory reporter with units " + mr.units);
continue;
}
let h = this._histograms[mr.path];
if (!h) {
h = Telemetry.getHistogramById(id);
this._histograms[mr.path] = h;
}
h.add(val);
this.addValue(mr.path, id, val);
}
return memReporters;
// XXX: bug 660731 will enable this
// "explicit" is found differently.
//this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024));
},
/**