summaryrefslogtreecommitdiffstats
path: root/mailnews/db/gloda/modules/indexer.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 20:14:28 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 20:14:28 -0500
commit4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067 (patch)
treeca0a81559d4a46f274283267a98ef3f3bc80d16e /mailnews/db/gloda/modules/indexer.js
parenta2a658f885ea5cca042709f5a53224dbe57fb478 (diff)
downloadUXP-4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067.tar
UXP-4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067.tar.gz
UXP-4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067.tar.lz
UXP-4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067.tar.xz
UXP-4d6dbd35f17620aaad7f4d4ade5d3a2634e1d067.zip
Revert "Issue #1273 - Remove Telemetry from Gloda"
This reverts commit 4db1ae892bad565e8e59ec6034b4c98946077248.
Diffstat (limited to 'mailnews/db/gloda/modules/indexer.js')
-rw-r--r--mailnews/db/gloda/modules/indexer.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/mailnews/db/gloda/modules/indexer.js b/mailnews/db/gloda/modules/indexer.js
index e75b6796b..f6c939530 100644
--- a/mailnews/db/gloda/modules/indexer.js
+++ b/mailnews/db/gloda/modules/indexer.js
@@ -1006,6 +1006,10 @@ var GlodaIndexer = {
// make ourselves less responsive by drawing out the period of time we
// are dominating the main thread.
this._perfIndexStopwatch.start();
+ // For telemetry purposes, we want to know how many messages we've been
+ // processing during that batch, and how long it took, pauses included.
+ let t0 = Date.now();
+ this._indexedMessageCount = 0;
batchCount = 0;
while (batchCount < this._indexTokens) {
if ((this._callbackHandle.activeIterator === null) &&
@@ -1146,6 +1150,21 @@ var GlodaIndexer = {
}
}
+ // All pauses have been taken, how effective were we? Report!
+ // XXX: there's possibly a lot of fluctuation since we go through here
+ // every 5 messages or even less
+ if (this._indexedMessageCount > 0) {
+ let delta = (Date.now() - t0)/1000; // in seconds
+ let v = Math.round(this._indexedMessageCount/delta);
+ try {
+ let h = Services.telemetry
+ .getHistogramById("THUNDERBIRD_INDEXING_RATE_MSG_PER_S");
+ h.add(v);
+ } catch (e) {
+ this._log.warn("Couldn't report telemetry", e, v);
+ }
+ }
+
if (batchCount > 0) {
let totalTime = this._perfIndexStopwatch.realTimeSeconds * 1000;
let timePerToken = totalTime / batchCount;