Backout c5b25c30befc:b217dfd70e22 (bug 1204994) for browser-chrome oranges; r=me

This commit is contained in:
Nathan Froyd 2015-09-17 05:09:13 -04:00
parent 98477d44be
commit 95e1026b8c
6 changed files with 38 additions and 91 deletions

View File

@ -13043,24 +13043,6 @@ nsDocument::ReportUseCounters()
// that feature were removed. Whereas with a document/top-level
// page split, we can see that N documents would be affected, but
// only a single web page would be affected.
// The difference between the values of these two histograms and the
// related use counters below tell us how many pages did *not* use
// the feature in question. For instance, if we see that a given
// session has destroyed 30 content documents, but a particular use
// counter shows only a count of 5, we can infer that the use
// counter was *not* used in 25 of those 30 documents.
//
// We do things this way, rather than accumulating a boolean flag
// for each use counter, to avoid sending histograms for features
// that don't get widely used. Doing things in this fashion means
// smaller telemetry payloads and faster processing on the server
// side.
Telemetry::Accumulate(Telemetry::CONTENT_DOCUMENTS_DESTROYED, 1);
if (IsTopLevelContentDocument()) {
Telemetry::Accumulate(Telemetry::TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED, 1);
}
for (int32_t c = 0;
c < eUseCounter_Count; ++c) {
UseCounter uc = static_cast<UseCounter>(c);
@ -13069,8 +13051,24 @@ nsDocument::ReportUseCounters()
static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter + uc * 2);
bool value = GetUseCounter(uc);
if (value) {
if (sDebugUseCounters) {
if (sDebugUseCounters && value) {
const char* name = Telemetry::GetHistogramName(id);
if (name) {
printf(" %s", name);
} else {
printf(" #%d", id);
}
printf(": %d\n", value);
}
Telemetry::Accumulate(id, value);
if (IsTopLevelContentDocument()) {
id = static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter +
uc * 2 + 1);
value = GetUseCounter(uc) || GetChildDocumentUseCounter(uc);
if (sDebugUseCounters && value) {
const char* name = Telemetry::GetHistogramName(id);
if (name) {
printf(" %s", name);
@ -13080,27 +13078,7 @@ nsDocument::ReportUseCounters()
printf(": %d\n", value);
}
Telemetry::Accumulate(id, 1);
}
if (IsTopLevelContentDocument()) {
id = static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter +
uc * 2 + 1);
value = GetUseCounter(uc) || GetChildDocumentUseCounter(uc);
if (value) {
if (sDebugUseCounters) {
const char* name = Telemetry::GetHistogramName(id);
if (name) {
printf(" %s", name);
} else {
printf(" #%d", id);
}
printf(": %d\n", value);
}
Telemetry::Accumulate(id, 1);
}
Telemetry::Accumulate(id, value);
}
}
}

View File

@ -104,14 +104,11 @@ function grabHistogramsFromContent(browser, use_counter_middlefix) {
return telemetry.getHistogramById(name).snapshot();
}
let histogram_page_name = "USE_COUNTER2_" + arg.middlefix + "_PAGE";
let histogram_document_name = "USE_COUNTER2_" + arg.middlefix + "_DOCUMENT";
let histogram_page_name = "USE_COUNTER_" + arg.middlefix + "_PAGE";
let histogram_document_name = "USE_COUNTER_" + arg.middlefix + "_DOCUMENT";
let histogram_page = snapshot_histogram(histogram_page_name);
let histogram_document = snapshot_histogram(histogram_document_name);
let histogram_docs = snapshot_histogram("CONTENT_DOCUMENTS_DESTROYED");
let histogram_toplevel_docs = snapshot_histogram("TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED");
return [histogram_page.sum, histogram_document.sum,
histogram_docs.sum, histogram_toplevel_docs.sum];
return [histogram_page.sum, histogram_document.sum];
});
}
@ -124,8 +121,7 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
// Hold on to the current values of the telemetry histograms we're
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
let [histogram_page_before, histogram_document_before] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
@ -165,17 +161,14 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
yield waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
let [histogram_page_after, histogram_document_after] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
is(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
"top level document counts are correct");
if (check_documents) {
is(histogram_document_after, histogram_document_before + 1,
"document counts for " + use_counter_middlefix + " after are correct");
"document counts " + use_counter_middlefix + " after are correct");
}
});
@ -188,8 +181,7 @@ var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
// Hold on to the current values of the telemetry histograms we're
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
let [histogram_page_before, histogram_document_before] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
@ -230,19 +222,12 @@ var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
yield waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
let [histogram_page_after, histogram_document_after] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
is(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
is(histogram_document_after, histogram_document_before + 1,
"document counts for " + use_counter_middlefix + " after are correct");
is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
"top level document counts are correct");
// 2 documents: one for the outer html page containing the <img> element, and
// one for the SVG image itself.
is(histogram_docs_after, histogram_docs_before + 2,
"document counts are correct");
"document counts " + use_counter_middlefix + " after are correct");
});
var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) {
@ -254,8 +239,7 @@ var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix
// Hold on to the current values of the telemetry histograms we're
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
let [histogram_page_before, histogram_document_before] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + file);
@ -283,15 +267,10 @@ var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix
yield waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
let [histogram_page_after, histogram_document_after] =
yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
(xfail ? todo_is : is)(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
(xfail ? todo_is : is)(histogram_document_after, histogram_document_before + 1,
"document counts for " + use_counter_middlefix + " after are correct");
is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
"top level document counts are correct");
is(histogram_docs_after, histogram_docs_before + 1,
"document counts are correct");
"document counts " + use_counter_middlefix + " after are correct");
});

View File

@ -62,8 +62,8 @@ def generate_histograms(filename):
'description': desc }
def append_counters(name, desc):
append_counter('USE_COUNTER2_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
append_counter('USE_COUNTER2_%s_PAGE' % name, 'Whether a page %s' % desc)
append_counter('USE_COUNTER_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
append_counter('USE_COUNTER_%s_PAGE' % name, 'Whether a page %s' % desc)
if counter['type'] == 'method':
method = '%s.%s' % (counter['interface_name'], counter['method_name'])

View File

@ -9348,16 +9348,6 @@
"releaseChannelCollection": "opt-out",
"description": "Reason for reporting the Adobe CDM to be unsupported. (1 = NOT_WINDOWS; 2 = WINDOWS_VERSION)"
},
"CONTENT_DOCUMENTS_DESTROYED": {
"expires_in_version": "never",
"kind": "count",
"description": "Number of content documents destroyed; used in conjunction with use counter histograms"
},
"TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED": {
"expires_in_version": "never",
"kind": "count",
"description": "Number of top-level content documents destroyed; used in conjunction with use counter histograms"
},
"FXA_CONFIGURED": {
"alert_emails": ["fx-team@mozilla.com"],
"expires_in_version": "45",

View File

@ -26,10 +26,10 @@ def main(output, *filenames):
print("enum ID : uint32_t {", file=output)
groups = itertools.groupby(histogram_tools.from_files(filenames),
lambda h: h.name().startswith("USE_COUNTER2_"))
lambda h: h.name().startswith("USE_COUNTER_"))
seen_use_counters = False
# Note that histogram_tools.py guarantees that all of the USE_COUNTER2_*
# Note that histogram_tools.py guarantees that all of the USE_COUNTER_*
# histograms are defined in a contiguous block. We therefore assume
# that there's at most one group for which use_counter_group is true.
for (use_counter_group, histograms) in groups:

View File

@ -293,7 +293,7 @@ def from_nsDeprecatedOperationList(filename):
op = match.group(1)
def add_counter(context):
name = 'USE_COUNTER2_DEPRECATED_%s_%s' % (op, context.upper())
name = 'USE_COUNTER_DEPRECATED_%s_%s' % (op, context.upper())
histograms[name] = {
'expires_in_version': 'never',
'kind': 'boolean',
@ -339,9 +339,9 @@ the histograms defined in filenames.
raise DefinitionException, "duplicate histogram name %s" % name
all_histograms[name] = definition
# We require that all USE_COUNTER2_* histograms be defined in a contiguous
# We require that all USE_COUNTER_* histograms be defined in a contiguous
# block.
use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER2_"),
use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER_"),
enumerate(all_histograms.iterkeys()));
if use_counter_indices:
lower_bound = use_counter_indices[0][0]