Bug 1260908 - Record IPC message sizes. r=dvander, a=ritu

MozReview-Commit-ID: Gw0Ov64iJSx
***
Bug 1260908 - Fix type of kMinTelemetryMessageSize. r=smaug a=ritu

MozReview-Commit-ID: 3ex89qCbRfJ
This commit is contained in:
Bill McCloskey 2016-04-14 09:22:44 -07:00
parent cb49c48762
commit 59e4188498
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 size_t 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);
@ -1033,6 +1039,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

@ -10415,5 +10415,25 @@
"expires_in_version": "55",
"kind": "boolean",
"description": "Result of call to SandboxBroker::Initialize"
},
"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"
}
}