Bug 1361661 - Part 2 - Make Telemetry IPC code pass around Telemetry::ProcessID. r=dexter

Switching to Telemetry::ProcessID allows us to break out extension process data from the content process data.
This commit is contained in:
Georg Fritzsche 2017-05-23 13:47:58 +07:00
Родитель 7f76d12d7d
Коммит 31c702afef
4 изменённых файлов: 37 добавлений и 20 удалений

Просмотреть файл

@ -286,6 +286,7 @@ using namespace mozilla::jsipc;
using namespace mozilla::psm;
using namespace mozilla::widget;
using mozilla::loader::PScriptCacheParent;
using mozilla::Telemetry::ProcessID;
// XXX Workaround for bug 986973 to maintain the existing broken semantics
template<>
@ -533,6 +534,16 @@ ScriptableCPInfo::GetMessageManager(nsIMessageSender** aMessenger)
return NS_OK;
}
ProcessID
GetTelemetryProcessID(const nsAString& remoteType)
{
// OOP WebExtensions run in a content process.
// For Telemetry though we want to break out collected data from the WebExtensions process into
// a separate bucket, to make sure we can analyze it separately and avoid skewing normal content
// process metrics.
return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE) ? ProcessID::Extension : ProcessID::Content;
}
} // anonymous namespace
nsTArray<ContentParent*>* ContentParent::sPrivateContent;
@ -5126,7 +5137,7 @@ mozilla::ipc::IPCResult
ContentParent::RecvAccumulateChildHistograms(
InfallibleTArray<Accumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType_Content, aAccumulations);
TelemetryIPC::AccumulateChildHistograms(GetTelemetryProcessID(mRemoteType), aAccumulations);
return IPC_OK();
}
@ -5134,7 +5145,7 @@ mozilla::ipc::IPCResult
ContentParent::RecvAccumulateChildKeyedHistograms(
InfallibleTArray<KeyedAccumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType_Content, aAccumulations);
TelemetryIPC::AccumulateChildKeyedHistograms(GetTelemetryProcessID(mRemoteType), aAccumulations);
return IPC_OK();
}
@ -5142,7 +5153,7 @@ mozilla::ipc::IPCResult
ContentParent::RecvUpdateChildScalars(
InfallibleTArray<ScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildScalars(GeckoProcessType_Content, aScalarActions);
TelemetryIPC::UpdateChildScalars(GetTelemetryProcessID(mRemoteType), aScalarActions);
return IPC_OK();
}
@ -5150,14 +5161,14 @@ mozilla::ipc::IPCResult
ContentParent::RecvUpdateChildKeyedScalars(
InfallibleTArray<KeyedScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType_Content, aScalarActions);
TelemetryIPC::UpdateChildKeyedScalars(GetTelemetryProcessID(mRemoteType), aScalarActions);
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvRecordChildEvents(nsTArray<mozilla::Telemetry::ChildEventData>&& aEvents)
{
TelemetryIPC::RecordChildEvents(GeckoProcessType_Content, aEvents);
TelemetryIPC::RecordChildEvents(GetTelemetryProcessID(mRemoteType), aEvents);
return IPC_OK();
}

Просмотреть файл

@ -165,35 +165,35 @@ GPUChild::RecvNotifyUiObservers(const nsCString& aTopic)
mozilla::ipc::IPCResult
GPUChild::RecvAccumulateChildHistograms(InfallibleTArray<Accumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType_GPU, aAccumulations);
TelemetryIPC::AccumulateChildHistograms(Telemetry::ProcessID::Gpu, aAccumulations);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvAccumulateChildKeyedHistograms(InfallibleTArray<KeyedAccumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType_GPU, aAccumulations);
TelemetryIPC::AccumulateChildKeyedHistograms(Telemetry::ProcessID::Gpu, aAccumulations);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvUpdateChildScalars(InfallibleTArray<ScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildScalars(GeckoProcessType_GPU, aScalarActions);
TelemetryIPC::UpdateChildScalars(Telemetry::ProcessID::Gpu, aScalarActions);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvUpdateChildKeyedScalars(InfallibleTArray<KeyedScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType_GPU, aScalarActions);
TelemetryIPC::UpdateChildKeyedScalars(Telemetry::ProcessID::Gpu, aScalarActions);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvRecordChildEvents(nsTArray<mozilla::Telemetry::ChildEventData>&& aEvents)
{
TelemetryIPC::RecordChildEvents(GeckoProcessType_GPU, aEvents);
TelemetryIPC::RecordChildEvents(Telemetry::ProcessID::Gpu, aEvents);
return IPC_OK();
}

Просмотреть файл

@ -12,35 +12,35 @@
namespace mozilla {
void
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType aProcessType,
TelemetryIPC::AccumulateChildHistograms(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::Accumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChild(aProcessType, aAccumulations);
}
void
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType aProcessType,
TelemetryIPC::AccumulateChildKeyedHistograms(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::KeyedAccumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChildKeyed(aProcessType, aAccumulations);
}
void
TelemetryIPC::UpdateChildScalars(GeckoProcessType aProcessType,
TelemetryIPC::UpdateChildScalars(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::ScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildData(aProcessType, aScalarActions);
}
void
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType aProcessType,
TelemetryIPC::UpdateChildKeyedScalars(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::KeyedScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildKeyedData(aProcessType, aScalarActions);
}
void
TelemetryIPC::RecordChildEvents(GeckoProcessType aProcessType, const nsTArray<Telemetry::ChildEventData>& aEvents)
TelemetryIPC::RecordChildEvents(Telemetry::ProcessID aProcessType, const nsTArray<Telemetry::ChildEventData>& aEvents)
{
TelemetryEvent::RecordChildEvents(aProcessType, aEvents);
}

Просмотреть файл

@ -8,6 +8,7 @@
#include "nsTArray.h"
#include "nsXULAppAPI.h"
#include "mozilla/TelemetryProcessEnums.h"
// This module provides the interface to accumulate Telemetry from child processes.
// Top-level actors for different child processes types (ContentParent, GPUChild)
@ -32,7 +33,8 @@ namespace TelemetryIPC {
* @param aProcessType - the process type to accumulate the histograms for
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChildHistograms(GeckoProcessType aProcessType, const nsTArray<Telemetry::Accumulation>& aAccumulations);
void AccumulateChildHistograms(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::Accumulation>& aAccumulations);
/**
* Accumulate child process data into keyed histograms for the given process type.
@ -40,7 +42,8 @@ void AccumulateChildHistograms(GeckoProcessType aProcessType, const nsTArray<Tel
* @param aProcessType - the process type to accumulate the keyed histograms for
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChildKeyedHistograms(GeckoProcessType aProcessType, const nsTArray<Telemetry::KeyedAccumulation>& aAccumulations);
void AccumulateChildKeyedHistograms(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::KeyedAccumulation>& aAccumulations);
/**
* Update scalars for the given process type with the data coming from child process.
@ -48,7 +51,8 @@ void AccumulateChildKeyedHistograms(GeckoProcessType aProcessType, const nsTArra
* @param aProcessType - the process type to process the scalar actions for
* @param aScalarActions - actions to update the scalar data
*/
void UpdateChildScalars(GeckoProcessType aProcessType, const nsTArray<Telemetry::ScalarAction>& aScalarActions);
void UpdateChildScalars(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::ScalarAction>& aScalarActions);
/**
* Update keyed scalars for the given process type with the data coming from child process.
@ -56,7 +60,8 @@ void UpdateChildScalars(GeckoProcessType aProcessType, const nsTArray<Telemetry:
* @param aProcessType - the process type to process the keyed scalar actions for
* @param aScalarActions - actions to update the keyed scalar data
*/
void UpdateChildKeyedScalars(GeckoProcessType aProcessType, const nsTArray<Telemetry::KeyedScalarAction>& aScalarActions);
void UpdateChildKeyedScalars(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::KeyedScalarAction>& aScalarActions);
/**
* Record events for the given process type with the data coming from child process.
@ -64,7 +69,8 @@ void UpdateChildKeyedScalars(GeckoProcessType aProcessType, const nsTArray<Telem
* @param aProcessType - the process type to record the events for
* @param aEvents - events to record
*/
void RecordChildEvents(GeckoProcessType aProcessType, const nsTArray<Telemetry::ChildEventData>& aEvents);
void RecordChildEvents(Telemetry::ProcessID aProcessType,
const nsTArray<Telemetry::ChildEventData>& aEvents);
}
}