Bug 1260908 - Record IPC message sizes (r=dvander)

This commit is contained in:
Bill McCloskey 2016-03-30 15:25:54 -07:00
parent 2471ddff5c
commit b3613ec89e
3 changed files with 44 additions and 0 deletions

View File

@ -69,6 +69,8 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::ipc;
static const int kMinTelemetryMessageSize = 8192;
nsFrameMessageManager::nsFrameMessageManager(mozilla::dom::ipc::MessageManagerCallback* aCallback,
nsFrameMessageManager* aParentManager,
/* mozilla::dom::ipc::MessageManagerFlags */ uint32_t aFlags)
@ -730,6 +732,12 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
return NS_ERROR_DOM_DATA_CLONE_ERR;
}
if (data.DataLength() >= kMinTelemetryMessageSize) {
Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE,
NS_ConvertUTF16toUTF8(aMessageName),
data.DataLength());
}
JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) {
objects = &aObjects.toObject();
@ -810,6 +818,12 @@ nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
return NS_ERROR_DOM_DATA_CLONE_ERR;
}
if (data.DataLength() >= kMinTelemetryMessageSize) {
Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE,
NS_ConvertUTF16toUTF8(aMessageName),
data.DataLength());
}
JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) {
objects = &aObjects.toObject();

View File

@ -118,6 +118,8 @@ static MessageChannel* gParentProcessBlocker;
namespace mozilla {
namespace ipc {
static const int kMinTelemetryMessageSize = 8192;
const int32_t MessageChannel::kNoTimeout = INT32_MIN;
// static
@ -749,6 +751,10 @@ MessageChannel::Echo(Message* aMsg)
bool
MessageChannel::Send(Message* aMsg)
{
if (aMsg->size() >= kMinTelemetryMessageSize) {
Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE, nsCString(aMsg->name()), aMsg->size());
}
CxxStackFrame frame(*this, OUT_MESSAGE, aMsg);
nsAutoPtr<Message> msg(aMsg);
@ -1045,6 +1051,10 @@ MessageChannel::ProcessPendingRequests(AutoEnterTransaction& aTransaction)
bool
MessageChannel::Send(Message* aMsg, Message* aReply)
{
if (aMsg->size() >= kMinTelemetryMessageSize) {
Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE, nsCString(aMsg->name()), aMsg->size());
}
nsAutoPtr<Message> msg(aMsg);
// Sanity checks.

View File

@ -10495,5 +10495,25 @@
"kind": "count",
"bug_numbers": [1237198],
"description": "Count tiny plugin content"
},
"IPC_MESSAGE_SIZE": {
"alert_emails": ["wmccloskey@mozilla.com"],
"bug_numbers": [1260908],
"expires_in_version": "55",
"kind": "exponential",
"high": 8000000,
"n_buckets": 50,
"keyed": true,
"description": "Measures the size of IPC messages by message name"
},
"MESSAGE_MANAGER_MESSAGE_SIZE": {
"alert_emails": ["wmccloskey@mozilla.com"],
"bug_numbers": [1260908],
"expires_in_version": "55",
"kind": "exponential",
"high": 8000000,
"n_buckets": 50,
"keyed": true,
"description": "Measures the size of message manager messages by message name"
}
}