Telemetry: Remove stubs and related code

This commit is contained in:
adeshkp 2019-01-12 06:20:31 -05:00 • committed by Roy Tam
commit aea50f182f
134 changed files with 68 additions and 3422 deletions

View file

@ -61,7 +61,6 @@
#include "mozilla/OperatorNewExtensions.h"
#include "mozilla/PendingAnimationTracker.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "mozilla/gfx/gfxVars.h"
@ -1857,7 +1856,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
RefPtr<ContainerLayer> root;
{
PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization);
root = layerBuilder->
BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this,
containerParameters, nullptr);
@ -7453,100 +7451,3 @@ nsDisplayFilter::PrintEffects(nsACString& aTo)
aTo += ")";
}
#endif
namespace mozilla {
uint32_t PaintTelemetry::sPaintLevel = 0;
uint32_t PaintTelemetry::sMetricLevel = 0;
EnumeratedArray<PaintTelemetry::Metric,
PaintTelemetry::Metric::COUNT,
double> PaintTelemetry::sMetrics;
PaintTelemetry::AutoRecordPaint::AutoRecordPaint()
{
// Don't record nested paints.
if (sPaintLevel++ > 0) {
return;
}
// Reset metrics for a new paint.
for (auto& metric : sMetrics) {
metric = 0.0;
}
mStart = TimeStamp::Now();
}
PaintTelemetry::AutoRecordPaint::~AutoRecordPaint()
{
MOZ_ASSERT(sPaintLevel != 0);
if (--sPaintLevel > 0) {
return;
}
// If we're in multi-process mode, don't include paint times for the parent
// process.
if (gfxVars::BrowserTabsRemoteAutostart() && XRE_IsParentProcess()) {
return;
}
double totalMs = (TimeStamp::Now() - mStart).ToMilliseconds();
// If the total time was >= 16ms, then it's likely we missed a frame due to
// painting. In this case we'll gather some detailed metrics below.
if (totalMs <= 16.0) {
return;
}
auto record = [=](const char* aKey, double aDurationMs) -> void {
MOZ_ASSERT(aDurationMs <= totalMs);
uint32_t amount = static_cast<int32_t>((aDurationMs / totalMs) * 100.0);
};
double dlMs = sMetrics[Metric::DisplayList];
double flbMs = sMetrics[Metric::Layerization];
double rMs = sMetrics[Metric::Rasterization];
// Record all permutations since aggregation makes it difficult to
// correlate. For example we can't derive "flb+r" from "dl" because we
// don't know the total time associated with a bucket entry. So we just
// play it safe and include everything. We can however derive "other" time
// from the final permutation.
record("dl", dlMs);
record("flb", flbMs);
record("r", rMs);
record("dl,flb", dlMs + flbMs);
record("dl,r", dlMs + rMs);
record("flb,r", flbMs + rMs);
record("dl,flb,r", dlMs + flbMs + rMs);
}
PaintTelemetry::AutoRecord::AutoRecord(Metric aMetric)
: mMetric(aMetric)
{
// Don't double-record anything nested.
if (sMetricLevel++ > 0) {
return;
}
// Don't record inside nested paints, or outside of paints.
if (sPaintLevel != 1) {
return;
}
mStart = TimeStamp::Now();
}
PaintTelemetry::AutoRecord::~AutoRecord()
{
MOZ_ASSERT(sMetricLevel != 0);
sMetricLevel--;
if (mStart.IsNull()) {
return;
}
sMetrics[mMetric] += (TimeStamp::Now() - mStart).ToMilliseconds();
}
} // namespace mozilla

View file

@ -4508,43 +4508,4 @@ public:
mutable mozilla::Maybe<bool> mIsFrameSelected;
};
namespace mozilla {
class PaintTelemetry
{
public:
enum class Metric {
DisplayList,
Layerization,
Rasterization,
COUNT,
};
class AutoRecord
{
public:
explicit AutoRecord(Metric aMetric);
~AutoRecord();
private:
Metric mMetric;
mozilla::TimeStamp mStart;
};
class AutoRecordPaint
{
public:
AutoRecordPaint();
~AutoRecordPaint();
private:
mozilla::TimeStamp mStart;
};
private:
static uint32_t sPaintLevel;
static uint32_t sMetricLevel;
static mozilla::EnumeratedArray<Metric, Metric::COUNT, double> sMetrics;
};
} // namespace mozilla
#endif /*NSDISPLAYLIST_H_*/

View file

@ -111,7 +111,6 @@
#include "FrameLayerBuilder.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/Telemetry.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/RuleNodeCacheConditions.h"
@ -3534,8 +3533,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
PROFILER_LABEL("nsLayoutUtils", "PaintFrame::BuildDisplayList",
js::ProfileEntry::Category::GRAPHICS);
PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::DisplayList);
aFrame->BuildDisplayListForStackingContext(&builder, dirtyRect, &list);
}

View file

@ -170,7 +170,6 @@
#include "mozilla/css/ImageLoader.h"
#include "mozilla/dom/DocumentTimeline.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsCanvasFrame.h"
#include "nsIImageLoadingContent.h"
#include "nsImageFrame.h"
@ -9394,9 +9393,6 @@ PresShell::DoVerifyReflow()
}
#endif
// used with Telemetry metrics
#define NS_LONG_REFLOW_TIME_MS 5000
bool
PresShell::ProcessReflowCommands(bool aInterruptible)
{

View file

@ -55,7 +55,6 @@
#include "nsDocShell.h"
#include "nsISimpleEnumerator.h"
#include "nsJSEnvironment.h"
#include "mozilla/Telemetry.h"
#include "gfxPrefs.h"
#include "BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
@ -524,46 +523,10 @@ private:
private:
~RefreshDriverVsyncObserver() = default;
void RecordTelemetryProbes(TimeStamp aVsyncTimestamp)
{
MOZ_ASSERT(NS_IsMainThread());
#ifndef ANDROID /* bug 1142079 */
if (XRE_IsParentProcess()) {
TimeDuration vsyncLatency = TimeStamp::Now() - aVsyncTimestamp;
uint32_t sample = (uint32_t)vsyncLatency.ToMilliseconds();
RecordJank(sample);
} else if (mVsyncRate != TimeDuration::Forever()) {
TimeDuration contentDelay = (TimeStamp::Now() - mLastChildTick) - mVsyncRate;
if (contentDelay.ToMilliseconds() < 0 ){
// Vsyncs are noisy and some can come at a rate quicker than
// the reported hardware rate. In those cases, consider that we have 0 delay.
contentDelay = TimeDuration::FromMilliseconds(0);
}
uint32_t sample = (uint32_t)contentDelay.ToMilliseconds();
RecordJank(sample);
} else {
// Request the vsync rate from the parent process. Might be a few vsyncs
// until the parent responds.
mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate();
}
#endif
}
void RecordJank(uint32_t aJankMS)
{
uint32_t duration = 1 /* ms */;
for (size_t i = 0;
i < mozilla::ArrayLength(sJankLevels) && duration < aJankMS;
++i, duration *= 2) {
sJankLevels[i]++;
}
}
void TickRefreshDriver(TimeStamp aVsyncTimestamp)
{
MOZ_ASSERT(NS_IsMainThread());
RecordTelemetryProbes(aVsyncTimestamp);
if (XRE_IsParentProcess()) {
MonitorAutoLock lock(mRefreshTickLock);
aVsyncTimestamp = mRecentVsync;
@ -2006,7 +1969,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
mViewManagerFlushIsPending = false;
RefPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager();
{
PaintTelemetry::AutoRecordPaint record;
vm->ProcessPendingUpdates();
}