Bug 1346866 - Make the IPC serialization/deserialization time probes main-thread-only, r=billm

MozReview-Commit-ID: 5Sc820Jh494
This commit is contained in:
Michael Layzell 2017-03-13 14:46:19 -04:00
parent d8777448ae
commit 9b0ad3267d
3 changed files with 9 additions and 9 deletions

View File

@ -465,10 +465,10 @@ bool Pickle::WriteSentinel(uint32_t sentinel) {
void Pickle::EndRead(PickleIterator& iter, uint32_t ipcMsgType) const {
DCHECK(iter.iter_.Done());
if (ipcMsgType != 0) {
if (NS_IsMainThread() && ipcMsgType != 0) {
uint32_t latencyMs = round((mozilla::TimeStamp::Now() - iter.start_).ToMilliseconds());
if (latencyMs >= kMinTelemetryIPCReadLatencyMs) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::IPC_READ_LATENCY_MS,
mozilla::Telemetry::Accumulate(mozilla::Telemetry::IPC_READ_MAIN_THREAD_LATENCY_MS,
nsDependentCString(mozilla::ipc::StringFromIPCMessageType(ipcMsgType)),
latencyMs);
}

View File

@ -786,12 +786,12 @@ MessageChannel::Send(Message* aMsg)
}
// If the message was created by the IPC bindings, the create time will be
// recorded. Use this information to report the IPC_WRITE_LATENCY_MS (time
// recorded. Use this information to report the IPC_WRITE_MAIN_THREAD_LATENCY_MS (time
// from message creation to it being sent).
if (aMsg->create_time()) {
if (NS_IsMainThread() && aMsg->create_time()) {
uint32_t latencyMs = round((mozilla::TimeStamp::Now() - aMsg->create_time()).ToMilliseconds());
if (latencyMs >= kMinTelemetryIPCWriteLatencyMs) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::IPC_WRITE_LATENCY_MS,
mozilla::Telemetry::Accumulate(mozilla::Telemetry::IPC_WRITE_MAIN_THREAD_LATENCY_MS,
nsDependentCString(aMsg->name()),
latencyMs);
}

View File

@ -11019,7 +11019,7 @@
"description": "Results of displaying add-on installation notifications.",
"releaseChannelCollection": "opt-out"
},
"IPC_READ_LATENCY_MS": {
"IPC_READ_MAIN_THREAD_LATENCY_MS": {
"alert_emails": ["mlayzell@mozilla.com"],
"bug_numbers": [1342635],
"expires_in_version": "60",
@ -11027,9 +11027,9 @@
"high": 500,
"n_buckets": 20,
"keyed": true,
"description": "Measures the number of milliseconds we spend waiting for IPC messages to deserialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
"description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to deserialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
},
"IPC_WRITE_LATENCY_MS": {
"IPC_WRITE_MAIN_THREAD_LATENCY_MS": {
"alert_emails": ["mlayzell@mozilla.com"],
"bug_numbers": [1342635],
"expires_in_version": "60",
@ -11037,6 +11037,6 @@
"high": 500,
"n_buckets": 20,
"keyed": true,
"description": "Measures the number of milliseconds we spend waiting for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
"description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name."
}
}