Backed out changeset 3a90f1f64d8d (bug 1339749) for bustage on a CLOSED TREE

--HG--
rename : toolkit/components/telemetry/ipc/TelemetryComms.h => toolkit/components/telemetry/TelemetryComms.h
rename : toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp => toolkit/components/telemetry/TelemetryIPCAccumulator.cpp
rename : toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.h => toolkit/components/telemetry/TelemetryIPCAccumulator.h
extra : amend_source : 2f4229556609103157901609fee02aaedcdb8606
This commit is contained in:
Carsten "Tomcat" Book 2017-02-15 16:10:29 +01:00
Родитель 816d0278d2
Коммит 5447789960
17 изменённых файлов: 131 добавлений и 180 удалений

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

@ -95,7 +95,6 @@
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TelemetryIPC.h"
#include "mozilla/WebBrowserPersistDocumentParent.h"
#include "mozilla/Unused.h"
#include "nsAnonymousTemporaryFile.h"
@ -4889,18 +4888,18 @@ ContentParent::ForceTabPaint(TabParent* aTabParent, uint64_t aLayerObserverEpoch
}
mozilla::ipc::IPCResult
ContentParent::RecvAccumulateChildHistograms(
ContentParent::RecvAccumulateChildHistogram(
InfallibleTArray<Accumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType_Content, aAccumulations);
Telemetry::AccumulateChild(GeckoProcessType_Content, aAccumulations);
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvAccumulateChildKeyedHistograms(
ContentParent::RecvAccumulateChildKeyedHistogram(
InfallibleTArray<KeyedAccumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType_Content, aAccumulations);
Telemetry::AccumulateChildKeyed(GeckoProcessType_Content, aAccumulations);
return IPC_OK();
}
@ -4908,7 +4907,7 @@ mozilla::ipc::IPCResult
ContentParent::RecvUpdateChildScalars(
InfallibleTArray<ScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildScalars(GeckoProcessType_Content, aScalarActions);
Telemetry::UpdateChildScalars(GeckoProcessType_Content, aScalarActions);
return IPC_OK();
}
@ -4916,7 +4915,7 @@ mozilla::ipc::IPCResult
ContentParent::RecvUpdateChildKeyedScalars(
InfallibleTArray<KeyedScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType_Content, aScalarActions);
Telemetry::UpdateChildKeyedScalars(GeckoProcessType_Content, aScalarActions);
return IPC_OK();
}

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

@ -1113,9 +1113,9 @@ private:
const int64_t& aLastModified,
const bool& aIsFromNsIFile) override;
virtual mozilla::ipc::IPCResult RecvAccumulateChildHistograms(
virtual mozilla::ipc::IPCResult RecvAccumulateChildHistogram(
InfallibleTArray<Accumulation>&& aAccumulations) override;
virtual mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms(
virtual mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistogram(
InfallibleTArray<KeyedAccumulation>&& aAccumulations) override;
virtual mozilla::ipc::IPCResult RecvUpdateChildScalars(
InfallibleTArray<ScalarAction>&& aScalarActions) override;

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

@ -1181,8 +1181,8 @@ parent:
/**
* Messages for communicating child Telemetry to the parent process
*/
async AccumulateChildHistograms(Accumulation[] accumulations);
async AccumulateChildKeyedHistograms(KeyedAccumulation[] accumulations);
async AccumulateChildHistogram(Accumulation[] accumulations);
async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations);
async UpdateChildScalars(ScalarAction[] updates);
async UpdateChildKeyedScalars(KeyedScalarAction[] updates);

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

@ -10,7 +10,6 @@
#include "GPUProcessHost.h"
#include "GPUProcessManager.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TelemetryIPC.h"
#include "mozilla/dom/CheckerboardReportService.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/gfx/gfxVars.h"
@ -142,30 +141,30 @@ GPUChild::RecvNotifyUiObservers(const nsCString& aTopic)
}
mozilla::ipc::IPCResult
GPUChild::RecvAccumulateChildHistograms(InfallibleTArray<Accumulation>&& aAccumulations)
GPUChild::RecvAccumulateChildHistogram(InfallibleTArray<Accumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType_GPU, aAccumulations);
Telemetry::AccumulateChild(GeckoProcessType_GPU, aAccumulations);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvAccumulateChildKeyedHistograms(InfallibleTArray<KeyedAccumulation>&& aAccumulations)
GPUChild::RecvAccumulateChildKeyedHistogram(InfallibleTArray<KeyedAccumulation>&& aAccumulations)
{
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType_GPU, aAccumulations);
Telemetry::AccumulateChildKeyed(GeckoProcessType_GPU, aAccumulations);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvUpdateChildScalars(InfallibleTArray<ScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildScalars(GeckoProcessType_GPU, aScalarActions);
Telemetry::UpdateChildScalars(GeckoProcessType_GPU, aScalarActions);
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvUpdateChildKeyedScalars(InfallibleTArray<KeyedScalarAction>&& aScalarActions)
{
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType_GPU, aScalarActions);
Telemetry::UpdateChildKeyedScalars(GeckoProcessType_GPU, aScalarActions);
return IPC_OK();
}

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

@ -43,8 +43,8 @@ public:
mozilla::ipc::IPCResult RecvInitComplete(const GPUDeviceData& aData) override;
mozilla::ipc::IPCResult RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem) override;
mozilla::ipc::IPCResult RecvAccumulateChildHistograms(InfallibleTArray<Accumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms(InfallibleTArray<KeyedAccumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvAccumulateChildHistogram(InfallibleTArray<Accumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistogram(InfallibleTArray<KeyedAccumulation>&& aAccumulations) override;
mozilla::ipc::IPCResult RecvUpdateChildScalars(InfallibleTArray<ScalarAction>&& aScalarActions) override;
mozilla::ipc::IPCResult RecvUpdateChildKeyedScalars(InfallibleTArray<KeyedScalarAction>&& aScalarActions) override;
void ActorDestroy(ActorDestroyReason aWhy) override;

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

@ -109,8 +109,8 @@ child:
async NotifyUiObservers(nsCString aTopic);
// Messages for reporting telemetry to the UI process.
async AccumulateChildHistograms(Accumulation[] accumulations);
async AccumulateChildKeyedHistograms(KeyedAccumulation[] accumulations);
async AccumulateChildHistogram(Accumulation[] accumulations);
async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations);
async UpdateChildScalars(ScalarAction[] actions);
async UpdateChildKeyedScalars(KeyedScalarAction[] actions);

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

@ -45,7 +45,7 @@
#include "Telemetry.h"
#include "TelemetryCommon.h"
#include "TelemetryHistogram.h"
#include "ipc/TelemetryIPCAccumulator.h"
#include "TelemetryIPCAccumulator.h"
#include "TelemetryScalar.h"
#include "TelemetryEvent.h"
#include "WebrtcTelemetry.h"
@ -3189,6 +3189,34 @@ AccumulateTimeDelta(ID aHistogram, TimeStamp start, TimeStamp end)
static_cast<uint32_t>((end - start).ToMilliseconds()));
}
void
AccumulateChild(GeckoProcessType aProcessType,
const nsTArray<Accumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChild(aProcessType, aAccumulations);
}
void
AccumulateChildKeyed(GeckoProcessType aProcessType,
const nsTArray<KeyedAccumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChildKeyed(aProcessType, aAccumulations);
}
void
UpdateChildScalars(GeckoProcessType aProcessType,
const nsTArray<ScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildData(aProcessType, aScalarActions);
}
void
UpdateChildKeyedScalars(GeckoProcessType aProcessType,
const nsTArray<KeyedScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildKeyedData(aProcessType, aScalarActions);
}
const char*
GetHistogramName(ID id)
{

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

@ -131,6 +131,34 @@ void AccumulateCategorical(ID id, const nsCString& label);
*/
void AccumulateTimeDelta(ID id, TimeStamp start, TimeStamp end = TimeStamp::Now());
/**
* Accumulate child process data into histograms for the given process type.
*
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChild(GeckoProcessType aProcessType, const nsTArray<Accumulation>& aAccumulations);
/**
* Accumulate child process data into keyed histograms for the given process type.
*
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChildKeyed(GeckoProcessType aProcessType, const nsTArray<KeyedAccumulation>& aAccumulations);
/**
* Update scalars for the given process type with the data coming from child process.
*
* @param aScalarActions - actions to update the scalar data
*/
void UpdateChildScalars(GeckoProcessType aProcessType, const nsTArray<ScalarAction>& aScalarActions);
/**
* Update keyed scalars for the given process type with the data coming from child process.
*
* @param aScalarActions - actions to update the keyed scalar data
*/
void UpdateChildKeyedScalars(GeckoProcessType aProcessType, const nsTArray<KeyedScalarAction>& aScalarActions);
/**
* Enable/disable recording for this histogram at runtime.
* Recording is enabled by default, unless listed at kRecordingInitiallyDisabledIDs[].

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

@ -23,7 +23,7 @@
#include "TelemetryCommon.h"
#include "TelemetryHistogram.h"
#include "ipc/TelemetryIPCAccumulator.h"
#include "TelemetryIPCAccumulator.h"
#include "base/histogram.h"
@ -39,7 +39,6 @@ using mozilla::Telemetry::Accumulation;
using mozilla::Telemetry::KeyedAccumulation;
using mozilla::Telemetry::Common::LogToBrowserConsole;
namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

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

@ -28,8 +28,6 @@ using mozilla::Telemetry::ScalarAction;
using mozilla::Telemetry::KeyedScalarAction;
using mozilla::Telemetry::ScalarVariant;
namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
// Sending each remote accumulation immediately places undue strain on the
// IPC subsystem. Batch the remote accumulations for a period of time before
// sending them all at once. This value was chosen as a balance between data
@ -170,11 +168,17 @@ TelemetryIPCAccumulator::RecordChildKeyedScalarAction(mozilla::Telemetry::Scalar
// This method takes the lock only to double-buffer the batched telemetry.
// It releases the lock before calling out to IPC code which can (and does)
// Accumulate (which would deadlock)
template<class TActor>
static void
SendAccumulatedData(TActor* ipcActor)
//
// To ensure we don't loop IPCTimerFired->AccumulateChild->arm timer, we don't
// unset gIPCTimerArmed until the IPC completes
//
// This function must be called on the main thread, otherwise IPC will fail.
void
TelemetryIPCAccumulator::IPCTimerFired(nsITimer* aTimer, void* aClosure)
{
// Get the accumulated data and free the storage buffers.
MOZ_ASSERT(NS_IsMainThread());
// Get the accumulated data and free the storage buffer.
nsTArray<Accumulation> accumulationsToSend;
nsTArray<KeyedAccumulation> keyedAccumulationsToSend;
nsTArray<ScalarAction> scalarsToSend;
@ -197,43 +201,47 @@ SendAccumulatedData(TActor* ipcActor)
}
// Send the accumulated data to the parent process.
mozilla::Unused << NS_WARN_IF(!ipcActor);
if (accumulationsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!ipcActor->SendAccumulateChildHistograms(accumulationsToSend));
}
if (keyedAccumulationsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!ipcActor->SendAccumulateChildKeyedHistograms(keyedAccumulationsToSend));
}
if (scalarsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!ipcActor->SendUpdateChildScalars(scalarsToSend));
}
if (keyedScalarsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!ipcActor->SendUpdateChildKeyedScalars(keyedScalarsToSend));
}
}
// To ensure we don't loop IPCTimerFired->AccumulateChild->arm timer, we don't
// unset gIPCTimerArmed until the IPC completes
//
// This function must be called on the main thread, otherwise IPC will fail.
void
TelemetryIPCAccumulator::IPCTimerFired(nsITimer* aTimer, void* aClosure)
{
MOZ_ASSERT(NS_IsMainThread());
// Send accumulated data to the correct parent process.
switch (XRE_GetProcessType()) {
case GeckoProcessType_Content:
SendAccumulatedData(mozilla::dom::ContentChild::GetSingleton());
case GeckoProcessType_Content: {
mozilla::dom::ContentChild* contentChild = mozilla::dom::ContentChild::GetSingleton();
mozilla::Unused << NS_WARN_IF(!contentChild);
if (contentChild) {
if (accumulationsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!contentChild->SendAccumulateChildHistogram(accumulationsToSend));
}
if (keyedAccumulationsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!contentChild->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend));
}
if (scalarsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!contentChild->SendUpdateChildScalars(scalarsToSend));
}
if (keyedScalarsToSend.Length()) {
mozilla::Unused <<
NS_WARN_IF(!contentChild->SendUpdateChildKeyedScalars(keyedScalarsToSend));
}
}
break;
case GeckoProcessType_GPU:
SendAccumulatedData(mozilla::gfx::GPUParent::GetSingleton());
}
case GeckoProcessType_GPU: {
if (mozilla::gfx::GPUParent* gpu = mozilla::gfx::GPUParent::GetSingleton()) {
if (accumulationsToSend.Length()) {
mozilla::Unused << gpu->SendAccumulateChildHistogram(accumulationsToSend);
}
if (keyedAccumulationsToSend.Length()) {
mozilla::Unused << gpu->SendAccumulateChildKeyedHistogram(keyedAccumulationsToSend);
}
if (scalarsToSend.Length()) {
mozilla::Unused << gpu->SendUpdateChildScalars(scalarsToSend);
}
if (keyedScalarsToSend.Length()) {
mozilla::Unused << gpu->SendUpdateChildKeyedScalars(keyedScalarsToSend);
}
}
break;
}
default:
MOZ_ASSERT_UNREACHABLE("Unsupported process type");
break;
@ -245,8 +253,6 @@ TelemetryIPCAccumulator::IPCTimerFired(nsITimer* aTimer, void* aClosure)
void
TelemetryIPCAccumulator::DeInitializeGlobalState()
{
MOZ_ASSERT(NS_IsMainThread());
StaticMutexAutoLock locker(gTelemetryIPCAccumulatorMutex);
if (gIPCTimer) {
NS_RELEASE(gIPCTimer);

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

@ -14,7 +14,6 @@ class nsITimer;
class nsAString;
class nsCString;
namespace mozilla {
namespace TelemetryIPCAccumulator {
// Histogram accumulation functions.
@ -36,7 +35,6 @@ void DeInitializeGlobalState();
void DispatchToMainThread(already_AddRefed<nsIRunnable>&& aEvent);
}
}
#endif // TelemetryIPCAccumulator_h__

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

@ -17,11 +17,11 @@
#include "mozilla/StaticMutex.h"
#include "mozilla/Unused.h"
#include "TelemetryComms.h"
#include "TelemetryCommon.h"
#include "TelemetryIPCAccumulator.h"
#include "TelemetryScalar.h"
#include "TelemetryScalarData.h"
#include "ipc/TelemetryComms.h"
#include "ipc/TelemetryIPCAccumulator.h"
using mozilla::StaticMutex;
using mozilla::StaticMutexAutoLock;
@ -33,8 +33,6 @@ using mozilla::Telemetry::Common::LogToBrowserConsole;
using mozilla::Telemetry::ScalarActionType;
using mozilla::Telemetry::ScalarVariant;
namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//

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

@ -7,8 +7,6 @@
#define TelemetryScalar_h__
#include "mozilla/TelemetryScalarEnums.h"
#include "nsXULAppAPI.h" // for GeckoProcessType
#include "ipc/TelemetryComms.h"
// This module is internal to Telemetry. It encapsulates Telemetry's
// scalar accumulation and storage logic. It should only be used by
@ -69,4 +67,4 @@ void UpdateChildKeyedData(GeckoProcessType aProcessType,
} // namespace TelemetryScalar
#endif // TelemetryScalar_h__
#endif // TelemetryScalar_h__

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

@ -1,41 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TelemetryIPC.h"
#include "../TelemetryScalar.h"
#include "../TelemetryHistogram.h"
namespace mozilla {
void
TelemetryIPC::AccumulateChildHistograms(GeckoProcessType aProcessType,
const nsTArray<Telemetry::Accumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChild(aProcessType, aAccumulations);
}
void
TelemetryIPC::AccumulateChildKeyedHistograms(GeckoProcessType aProcessType,
const nsTArray<Telemetry::KeyedAccumulation>& aAccumulations)
{
TelemetryHistogram::AccumulateChildKeyed(aProcessType, aAccumulations);
}
void
TelemetryIPC::UpdateChildScalars(GeckoProcessType aProcessType,
const nsTArray<Telemetry::ScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildData(aProcessType, aScalarActions);
}
void
TelemetryIPC::UpdateChildKeyedScalars(GeckoProcessType aProcessType,
const nsTArray<Telemetry::KeyedScalarAction>& aScalarActions)
{
TelemetryScalar::UpdateChildKeyedData(aProcessType, aScalarActions);
}
}

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

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef TelemetryIPC_h__
#define TelemetryIPC_h__
#include "nsTArray.h"
#include "nsXULAppAPI.h"
// This module provides the interface to accumulate Telemetry from child processes.
// Top-level actors for different child processes types (ContentParent, GPUChild)
// will call this for messages from their respective processes.
namespace mozilla {
namespace Telemetry {
struct Accumulation;
struct KeyedAccumulation;
struct ScalarAction;
struct KeyedScalarAction;
}
namespace TelemetryIPC {
/**
* Accumulate child process data into histograms for the given process type.
*
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChildHistograms(GeckoProcessType aProcessType, const nsTArray<Telemetry::Accumulation>& aAccumulations);
/**
* Accumulate child process data into keyed histograms for the given process type.
*
* @param aAccumulations - accumulation actions to perform
*/
void AccumulateChildKeyedHistograms(GeckoProcessType aProcessType, const nsTArray<Telemetry::KeyedAccumulation>& aAccumulations);
/**
* Update scalars for the given process type with the data coming from child process.
*
* @param aScalarActions - actions to update the scalar data
*/
void UpdateChildScalars(GeckoProcessType aProcessType, const nsTArray<Telemetry::ScalarAction>& aScalarActions);
/**
* Update keyed scalars for the given process type with the data coming from child process.
*
* @param aScalarActions - actions to update the keyed scalar data
*/
void UpdateChildKeyedScalars(GeckoProcessType aProcessType, const nsTArray<Telemetry::KeyedScalarAction>& aScalarActions);
}
}
#endif // TelemetryIPC_h__

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

@ -43,20 +43,18 @@ EXPORTS.mozilla += [
'!TelemetryEventEnums.h',
'!TelemetryHistogramEnums.h',
'!TelemetryScalarEnums.h',
'ipc/TelemetryComms.h',
'ipc/TelemetryIPC.h',
'ProcessedStack.h',
'Telemetry.h',
'TelemetryComms.h',
'ThreadHangStats.h',
]
SOURCES += [
'ipc/TelemetryIPC.cpp',
'ipc/TelemetryIPCAccumulator.cpp',
'Telemetry.cpp',
'TelemetryCommon.cpp',
'TelemetryEvent.cpp',
'TelemetryHistogram.cpp',
'TelemetryIPCAccumulator.cpp',
'TelemetryScalar.cpp',
'WebrtcTelemetry.cpp',
]