Bug 1348113 - Part 1: Add the IPC_SYNC_JS_LATENCY_MS probe to track JS sync IPC latency from sendSyncMessage/sendRpcMessage, r=billm

MozReview-Commit-ID: 6ROx87BL18p
This commit is contained in:
Michael Layzell 2017-03-20 18:18:55 -04:00
parent ee460f557c
commit 490a6868bf
3 changed files with 22 additions and 0 deletions

View File

@ -658,6 +658,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
nsTArray<StructuredCloneData> retval;
TimeStamp start = TimeStamp::Now();
sSendingSyncMessage |= aIsSync;
bool ok = mCallback->DoSendBlockingMessage(aCx, aMessageName, data, objects,
aPrincipal, &retval, aIsSync);
@ -665,6 +666,12 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
sSendingSyncMessage = false;
}
uint32_t latencyMs = round((TimeStamp::Now() - start).ToMilliseconds());
if (latencyMs >= kMinTelemetrySyncMessageManagerLatencyMs) {
Telemetry::Accumulate(Telemetry::IPC_SYNC_MESSAGE_MANAGER_LATENCY_MS,
NS_ConvertUTF16toUTF8(aMessageName), latencyMs);
}
if (!ok) {
return NS_OK;
}

View File

@ -44,6 +44,10 @@ class MessageManagerReporter;
namespace ipc {
// Note: we round the time we spend to the nearest millisecond. So a min value
// of 1 ms actually captures from 500us and above.
static const uint32_t kMinTelemetrySyncMessageManagerLatencyMs = 1;
enum MessageManagerFlags {
MM_CHILD = 0,
MM_CHROME = 1,

View File

@ -11275,5 +11275,16 @@
"n_buckets": 100,
"bug_numbers": [1341531],
"description": "Time (ms) for the APZ handled wheel event to dispatch, but before handlers executing."
},
"IPC_SYNC_MESSAGE_MANAGER_LATENCY_MS": {
"alert_emails": ["michael@thelayzells.com"],
"bug_numbers": [1348113],
"expires_in_version": "60",
"kind": "exponential",
"low": 32,
"high": 750,
"n_buckets": 40,
"keyed": true,
"description": "Measures the number of milliseconds we spend waiting for sync message manager IPC messages to finish sending, keyed by message name. Note: only messages that wait for more than 500 microseconds are included in this probe."
}
}