зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1573904 - Measure the potential for a streaming parser. data-review=chutten r=jorendorff,chutten
Differential Revision: https://phabricator.services.mozilla.com/D42039 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
19c05de902
Коммит
2b2064b0e4
|
@ -71,6 +71,22 @@ nsresult ScriptLoadHandler::DecodeRawDataHelper(const uint8_t* aData,
|
|||
MakeSpan(scriptText.begin() + haveRead, needed.value()), aEndOfStream);
|
||||
MOZ_ASSERT(written <= needed.value());
|
||||
|
||||
// Telemetry: Measure the throughput at which bytes are streamed and the ratio
|
||||
// of streamed bytes, such that we can determine the effectiveness of a
|
||||
// streaming parser for JavaScript.
|
||||
using namespace mozilla::Telemetry;
|
||||
if (aEndOfStream && haveRead) {
|
||||
// Compute the percent of data transfered incrementally.
|
||||
Accumulate(DOM_SCRIPT_LOAD_INCREMENTAL_RATIO, 100 * haveRead / (haveRead + written));
|
||||
// Compute the rate of transfer of the incremental data calls averaged
|
||||
// across the time needed to complete the request.
|
||||
double ms = (TimeStamp::Now() - mFirstOnIncrementalData).ToMilliseconds();
|
||||
Accumulate(DOM_SCRIPT_LOAD_INCREMENTAL_AVG_TRANSFER_RATE, haveRead / ms);
|
||||
}
|
||||
if (!aEndOfStream && !haveRead) {
|
||||
mFirstOnIncrementalData = TimeStamp::Now();
|
||||
}
|
||||
|
||||
haveRead += written;
|
||||
MOZ_ASSERT(haveRead <= capacity.value(),
|
||||
"mDecoder produced more data than expected");
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#define mozilla_dom_ScriptLoadHandler_h
|
||||
|
||||
#include "nsIIncrementalStreamLoader.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -97,6 +98,9 @@ class ScriptLoadHandler final : public nsIIncrementalStreamLoaderObserver {
|
|||
|
||||
// Unicode decoder for charset.
|
||||
mozilla::UniquePtr<mozilla::Decoder> mDecoder;
|
||||
|
||||
// Used to compute the DOM_SCRIPT_LOAD_INCREMENTAL_AVG_TRANSFER_RATE telemetry.
|
||||
TimeStamp mFirstOnIncrementalData;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -13702,6 +13702,30 @@
|
|||
"labels": ["Used", "RejectedByPolicy", "RequestMismatch", "LoadError", "NotUsed"],
|
||||
"description": "Whether a preloaded script was used or the reason it was not used."
|
||||
},
|
||||
"DOM_SCRIPT_LOAD_INCREMENTAL_RATIO": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
|
||||
"expires_in_version": "75",
|
||||
"kind": "linear",
|
||||
"low": 2,
|
||||
"high": 100,
|
||||
"n_buckets": 99,
|
||||
"bug_numbers": [1573904],
|
||||
"description": "Ratio of JavaScript-text bytes transferred incrementally compared to the total number of bytes transferred."
|
||||
},
|
||||
"DOM_SCRIPT_LOAD_INCREMENTAL_AVG_TRANSFER_RATE": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec", "geckoview"],
|
||||
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
|
||||
"expires_in_version": "75",
|
||||
"kind": "exponential",
|
||||
"low": 1,
|
||||
"high": 1000000,
|
||||
"n_buckets": 60,
|
||||
"bug_numbers": [1573904],
|
||||
"description": "Speed at which JavaScript-text bytes are transferred incrementally, measured between the first onIncremantalData call and the onStreamComplete call (in character/ms)."
|
||||
},
|
||||
"VIDEO_DROPPED_FRAMES_PROPORTION" : {
|
||||
"record_in_processes": ["content"],
|
||||
"products": ["firefox", "geckoview"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче