forked from mirrors/gecko-dev
This telemetry was trying to measure three things:
* The time spent during style / layout in a tick. This is useful.
* The times SetNeed{Style,Layout} flush have been called. This is not a
particularly useful metric, there's not much to learn or change from
it. Any call is basically free as long as they're consecutive /
there's no flush in between.
* The number of times layout / style has been flushed during a tick.
This is more useful than the above but, similarly, there's not too
much to be learned here. Number of flushes can be completely
orthogonal to how expensive it has been.
It also had a number of flaws:
* It is recorded per-PresShell, so we get multiple pings per tick.
* Similarly, if a sub-frame dies before the tick, we just never report
that time.
Instead, refactor it to make it simpler, and just record the first
metric reliably. This simplifies the code substantially, and I don't
think we're losing much.
The histograms are also expired. We might want to renew this, I'll file
a follow-up to either properly renew this if we plan to look at it, or
remove the code entirely from the tree.
Differential Revision: https://phabricator.services.mozilla.com/D210907
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
/* -*- 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/. */
|
|
|
|
/* Tools for collecting and reporting layout and style telemetry */
|
|
|
|
#ifndef mozilla_LayoutTelemetryTools_h
|
|
#define mozilla_LayoutTelemetryTools_h
|
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
#define LAYOUT_TELEMETRY_RECORD(subsystem) \
|
|
mozilla::layout_telemetry::AutoRecord a( \
|
|
mozilla::layout_telemetry::LayoutSubsystem::subsystem)
|
|
|
|
namespace mozilla::layout_telemetry {
|
|
|
|
// Send the current per-tick telemetry.
|
|
void PingPerTickTelemetry();
|
|
|
|
enum class LayoutSubsystem : uint8_t {
|
|
Restyle,
|
|
Reflow,
|
|
ReflowFlex,
|
|
ReflowGrid,
|
|
ReflowTable,
|
|
ReflowText,
|
|
Count
|
|
};
|
|
|
|
class AutoRecord {
|
|
public:
|
|
explicit AutoRecord(LayoutSubsystem aSubsystem);
|
|
~AutoRecord();
|
|
|
|
private:
|
|
AutoRecord* const mParentRecord;
|
|
const LayoutSubsystem mSubsystem;
|
|
TimeStamp mStartTime;
|
|
double mDurationMs = 0.0;
|
|
};
|
|
|
|
} // namespace mozilla::layout_telemetry
|
|
|
|
#endif // !mozilla_LayoutTelemetryTools_h
|