Bug 1461672 - Remove Telemetry probe added to tune the JSBC. r=francois,bkelly

This commit is contained in:
Nicolas B. Pierron 2018-05-21 13:40:04 +00:00
parent 8e95453379
commit bdd58b3482
7 changed files with 7 additions and 250 deletions

View File

@ -35,12 +35,6 @@ enum UseCounter : int16_t {
eUseCounter_Count
};
enum IncCounter : int16_t {
eIncCounter_UNKNOWN = -1,
eIncCounter_ScriptTag,
eIncCounter_Count
};
}
#endif

View File

@ -1492,7 +1492,6 @@ nsIDocument::nsIDocument()
mUseCounters(0),
mChildDocumentUseCounters(0),
mNotifiedPageForUseCounter(0),
mIncCounters(),
mUserHasInteracted(false),
mUserHasActivatedInteraction(false),
mStackRefCnt(0),
@ -1509,9 +1508,6 @@ nsIDocument::nsIDocument()
mIgnoreOpensDuringUnloadCounter(0)
{
SetIsInDocument();
for (auto& cnt : mIncCounters) {
cnt = 0;
}
}
nsDocument::nsDocument(const char* aContentType)
@ -12159,11 +12155,6 @@ nsIDocument::ReportUseCounters(UseCounterReportKind aKind)
}
}
}
if (IsContentDocument() || IsResourceDoc()) {
uint16_t num = mIncCounters[eIncCounter_ScriptTag];
Telemetry::Accumulate(Telemetry::DOM_SCRIPT_EVAL_PER_DOCUMENT, num);
}
}
void

View File

@ -3381,11 +3381,6 @@ public:
void PropagateUseCounters(nsIDocument* aParentDocument);
void SetDocumentIncCounter(mozilla::IncCounter aIncCounter, uint32_t inc = 1)
{
mIncCounters[aIncCounter] += inc;
}
void SetUserHasInteracted(bool aUserHasInteracted);
bool UserHasInteracted()
{
@ -4241,9 +4236,6 @@ protected:
// for this child document.
std::bitset<mozilla::eUseCounter_Count> mNotifiedPageForUseCounter;
// Count the number of times something is seen in a document.
mozilla::Array<uint16_t, mozilla::eIncCounter_Count> mIncCounters;
// Whether the user has interacted with the document or not:
bool mUserHasInteracted;

View File

@ -163,11 +163,6 @@ ScriptLoadHandler::EnsureDecoder(nsIIncrementalStreamLoader* aLoader,
if (!EnsureDecoder(aLoader, aData, aDataLength, aEndOfStream, charset)) {
return false;
}
if (charset.Length() == 0) {
charset = "?";
}
mozilla::Telemetry::Accumulate(mozilla::Telemetry::DOM_SCRIPT_SRC_ENCODING,
charset);
return true;
}

View File

@ -193,8 +193,7 @@ ScriptLoader::~ScriptLoader()
// Collect telemtry data about the cache information, and the kind of source
// which are being loaded, and where it is being loaded from.
static void
CollectScriptTelemetry(nsIIncrementalStreamLoader* aLoader,
ScriptLoadRequest* aRequest)
CollectScriptTelemetry(ScriptLoadRequest* aRequest)
{
using namespace mozilla::Telemetry;
@ -210,45 +209,27 @@ CollectScriptTelemetry(nsIIncrementalStreamLoader* aLoader,
AccumulateCategorical(LABELS_DOM_SCRIPT_KIND::ClassicScript);
}
// Report the type of source, as well as the size of the source.
// Report the type of source. This is used to monitor the status of the
// JavaScript Start-up Bytecode Cache, with the expectation of an almost zero
// source-fallback and alternate-data being roughtly equal to source loads.
if (aRequest->IsLoadingSource()) {
if (aRequest->mIsInline) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::Inline);
nsAutoString inlineData;
aRequest->mElement->GetScriptText(inlineData);
Accumulate(DOM_SCRIPT_INLINE_SIZE, inlineData.Length());
} else if (aRequest->IsTextSource()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::SourceFallback);
Accumulate(DOM_SCRIPT_SOURCE_SIZE, aRequest->ScriptText().length());
}
// TODO: Add telemetry for BinAST encoded source.
} else {
MOZ_ASSERT(aRequest->IsLoading());
if (aRequest->IsTextSource()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::Source);
Accumulate(DOM_SCRIPT_SOURCE_SIZE, aRequest->ScriptText().length());
} else if (aRequest->IsBytecode()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::AltData);
Accumulate(DOM_SCRIPT_BYTECODE_SIZE, aRequest->mScriptBytecode.length());
}
// TODO: Add telemetry for BinAST encoded source.
}
// Skip if we do not have any cache information for the given script.
if (!aLoader) {
return;
}
nsCOMPtr<nsIRequest> channel;
aLoader->GetRequest(getter_AddRefs(channel));
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
if (!cic) {
return;
}
int32_t fetchCount = 0;
if (NS_SUCCEEDED(cic->GetCacheTokenFetchCount(&fetchCount))) {
Accumulate(DOM_SCRIPT_FETCH_COUNT, fetchCount);
}
}
// Helper method for checking if the script element is an event-handler
@ -1519,7 +1500,7 @@ ScriptLoader::ProcessInlineScript(nsIScriptElement* aElement,
request->mProgress = ScriptLoadRequest::Progress::eLoading_Source;
request->SetTextSource();
TRACE_FOR_TEST_BOOL(request->mElement, "scriptloader_load_source");
CollectScriptTelemetry(nullptr, request);
CollectScriptTelemetry(request);
// Only the 'async' attribute is heeded on an inline module script and
// inline classic scripts ignore both these attributes.
@ -2199,20 +2180,6 @@ ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest)
return true;
}
static bool
ShouldRecordParseTimeTelemetry(ScriptLoadRequest* aRequest)
{
static const size_t MinScriptChars = 1024;
static const size_t MinBinASTBytes = 700;
if (aRequest->IsTextSource()) {
return aRequest->ScriptText().length() >= MinScriptChars;
} else {
MOZ_ASSERT(aRequest->IsBinASTSource());
return aRequest->ScriptBinASTData().length() >= MinBinASTBytes;
}
}
nsresult
ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
{
@ -2231,9 +2198,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
// Report telemetry results of the number of scripts evaluated.
mDocument->SetDocumentIncCounter(IncCounter::eIncCounter_ScriptTag);
// Get the script-type to be used by this element.
NS_ASSERTION(scriptContent, "no content - what is default script-type?");
@ -2318,11 +2282,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
nsJSUtils::ExecutionContext exec(cx, global);
if (aRequest->mOffThreadToken) {
LOG(("ScriptLoadRequest (%p): Decode Bytecode & Join and Execute", aRequest));
AutoTimer<DOM_SCRIPT_OFF_THREAD_DECODE_EXEC_MS> timer;
rv = exec.DecodeJoinAndExec(&aRequest->mOffThreadToken);
} else {
LOG(("ScriptLoadRequest (%p): Decode Bytecode and Execute", aRequest));
AutoTimer<DOM_SCRIPT_MAIN_THREAD_DECODE_EXEC_MS> timer;
rv = exec.DecodeAndExec(options, aRequest->mScriptBytecode,
aRequest->mBytecodeOffset);
}
@ -2334,14 +2296,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
JS::Rooted<JSScript*> script(cx);
bool encodeBytecode = ShouldCacheBytecode(aRequest);
TimeStamp start;
if (Telemetry::CanRecordExtended()) {
// Only record telemetry for scripts which are above a threshold.
if (aRequest->mCacheInfo && ShouldRecordParseTimeTelemetry(aRequest)) {
start = TimeStamp::Now();
}
}
{
nsJSUtils::ExecutionContext exec(cx, global);
exec.SetEncodeBytecode(encodeBytecode);
@ -2356,12 +2310,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
MOZ_ASSERT(aRequest->IsTextSource());
rv = exec.JoinAndExec(&aRequest->mOffThreadToken, &script);
}
if (start) {
AccumulateTimeDelta(encodeBytecode
? DOM_SCRIPT_OFF_THREAD_PARSE_ENCODE_EXEC_MS
: DOM_SCRIPT_OFF_THREAD_PARSE_EXEC_MS,
start);
}
} else {
// Main thread parsing (inline and small scripts)
LOG(("ScriptLoadRequest (%p): Compile And Exec", aRequest));
@ -2376,12 +2324,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
rv = exec.CompileAndExec(options, srcBuf, &script);
}
if (start) {
AccumulateTimeDelta(encodeBytecode
? DOM_SCRIPT_MAIN_THREAD_PARSE_ENCODE_EXEC_MS
: DOM_SCRIPT_MAIN_THREAD_PARSE_EXEC_MS,
start);
}
}
}
@ -2499,7 +2441,6 @@ ScriptLoader::EncodeBytecode()
return;
}
Telemetry::AutoTimer<Telemetry::DOM_SCRIPT_ENCODING_MS_PER_DOCUMENT> timer;
AutoEntryScript aes(globalObject, "encode bytecode", true);
RefPtr<ScriptLoadRequest> request;
while (!mBytecodeEncodingQueue.isEmpty()) {
@ -2524,14 +2465,12 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
if (!JS::FinishIncrementalEncoding(aCx, script, aRequest->mScriptBytecode)) {
LOG(("ScriptLoadRequest (%p): Cannot serialize bytecode",
aRequest));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::EncodingFailure);
return;
}
if (aRequest->mScriptBytecode.length() >= UINT32_MAX) {
LOG(("ScriptLoadRequest (%p): Bytecode cache is too large to be decoded correctly.",
aRequest));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::BufferTooLarge);
return;
}
@ -2545,7 +2484,6 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
if (NS_FAILED(rv)) {
LOG(("ScriptLoadRequest (%p): Cannot open bytecode cache (rv = %X, output = %p)",
aRequest, unsigned(rv), output.get()));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::OpenFailure);
return;
}
MOZ_ASSERT(output);
@ -2553,9 +2491,6 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
nsresult rv = output->Close();
LOG(("ScriptLoadRequest (%p): Closing (rv = %X)",
aRequest, unsigned(rv)));
if (NS_FAILED(rv)) {
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::CloseFailure);
}
});
uint32_t n;
@ -2564,13 +2499,11 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
LOG(("ScriptLoadRequest (%p): Write bytecode cache (rv = %X, length = %u, written = %u)",
aRequest, unsigned(rv), unsigned(aRequest->mScriptBytecode.length()), n));
if (NS_FAILED(rv)) {
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::WriteFailure);
return;
}
bytecodeFailed.release();
TRACE_FOR_TEST_NONE(aRequest->mElement, "scriptloader_bytecode_saved");
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::EncodingSuccess);
}
void
@ -2816,10 +2749,6 @@ ScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
Unused << hadErrors;
aLengthOut = written;
nsAutoCString charset;
unicodeDecoder->Encoding()->Name(charset);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::DOM_SCRIPT_SRC_ENCODING,
charset);
return NS_OK;
}
@ -3135,7 +3064,7 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
return NS_BINDING_ABORTED;
}
MOZ_ASSERT(aRequest->IsLoading());
CollectScriptTelemetry(aLoader, aRequest);
CollectScriptTelemetry(aRequest);
// If we don't have a document, then we need to abort further
// evaluation.

View File

@ -12398,158 +12398,15 @@
"labels": ["ClassicScript", "ModuleScript"],
"description": "Record the kind of every script loaded in a document."
},
"DOM_SCRIPT_SRC_ENCODING": {
"record_in_processes": ["main", "content"],
"alert_emails": ["dteller@mozilla.com"],
"expires_in_version": "61",
"kind": "count",
"keyed": true,
"bug_numbers": [1344152],
"description": "Note the encoding (e.g. 'UTF-8', 'windows-1252', 'ASCII') of each external <script> element that is successfully loaded and decoded."
},
"DOM_SCRIPT_LOADING_SOURCE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"expires_in_version": "never",
"kind": "categorical",
"bug_numbers": [1362114],
"labels": ["Inline", "SourceFallback", "Source", "AltData"],
"description": "Record the input from which the bytes are coming from, for each script in a document."
},
"DOM_SCRIPT_INLINE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of characters) of each script which is inlined in a document."
},
"DOM_SCRIPT_SOURCE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of characters) of each script which is streamed in plain-text in a document."
},
"DOM_SCRIPT_BYTECODE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of bytes) of each script which is streamed in encoded-format in a document."
},
"DOM_SCRIPT_FETCH_COUNT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"low": 1,
"high": 100,
"n_buckets": 99,
"bug_numbers": [1362114],
"description": "For each script in a document, record the number of times it was requested since it got saved in the cache."
},
"DOM_SCRIPT_MAIN_THREAD_PARSE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse and execute a script (which might be encoded later) on the main thread."
},
"DOM_SCRIPT_MAIN_THREAD_PARSE_ENCODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse, encode and execute a script on the main thread."
},
"DOM_SCRIPT_MAIN_THREAD_DECODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to decode and execute a script on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_PARSE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse off-main-thread and execute a script (which might be encoded later) on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_PARSE_ENCODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse off-main-thread, encode and execute a script on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_DECODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to decode off-main-thread and execute a script on the main thread."
},
"DOM_SCRIPT_ENCODING_MS_PER_DOCUMENT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"high": 64,
"n_buckets": 32,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to encode all scripts in a document."
},
"DOM_SCRIPT_ENCODING_STATUS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "categorical",
"bug_numbers": [1362114],
"labels": ["EncodingFailure", "BufferTooLarge", "OpenFailure", "WriteFailure", "CloseFailure", "EncodingSuccess"],
"description": "Record the failure reasons of the JavaScript Start-up Bytecode Cache encoder."
},
"DOM_SCRIPT_EVAL_PER_DOCUMENT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"low": 1,
"high": 200,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Number of script tags evaluated per document."
},
"DOM_SCRIPT_PRELOAD_RESULT": {
"record_in_processes": ["main", "content"],
"alert_emails": ["jcoppeard@mozilla.com"],

View File

@ -1553,7 +1553,6 @@
"DEVTOOLS_WEBIDE_IMPORT_PROJECT_COUNT",
"DEVTOOLS_WEBIDE_NEW_PROJECT_COUNT",
"DEVTOOLS_WEBIDE_OPENED_COUNT",
"DOM_SCRIPT_SRC_ENCODING",
"ENABLE_PRIVILEGE_EVER_CALLED",
"FENNEC_DISTRIBUTION_REFERRER_INVALID",
"FENNEC_ORBOT_INSTALLED",