#include "third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h"
#include <memory>
#include "base/format_macros.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/rand_util.h"
#include "base/time/default_tick_clock.h"
#include "cc/metrics/begin_main_frame_metrics.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/common/metrics/document_update_reason.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace {
inline base::HistogramBase::Sample ToSample(int64_t value) { … }
inline int64_t ApplyBucket(int64_t value) { … }
}
namespace blink {
int64_t LocalFrameUkmAggregator::ApplyBucketIfNecessary(int64_t value,
unsigned metric_id) { … }
LocalFrameUkmAggregator::ScopedUkmHierarchicalTimer::ScopedUkmHierarchicalTimer(
scoped_refptr<LocalFrameUkmAggregator> aggregator,
size_t metric_index,
const base::TickClock* clock)
: … { … }
LocalFrameUkmAggregator::ScopedUkmHierarchicalTimer::ScopedUkmHierarchicalTimer(
ScopedUkmHierarchicalTimer&& other)
: … { … }
LocalFrameUkmAggregator::ScopedUkmHierarchicalTimer::
~ScopedUkmHierarchicalTimer() { … }
LocalFrameUkmAggregator::IterativeTimer::IterativeTimer(
LocalFrameUkmAggregator& aggregator)
: … { … }
LocalFrameUkmAggregator::IterativeTimer::~IterativeTimer() { … }
void LocalFrameUkmAggregator::IterativeTimer::StartInterval(
int64_t metric_index) { … }
void LocalFrameUkmAggregator::IterativeTimer::Record(
bool should_record_prev_metric,
bool should_record_next_metric) { … }
void LocalFrameUkmAggregator::AbsoluteMetricRecord::reset() { … }
LocalFrameUkmAggregator::LocalFrameUkmAggregator()
: … { … }
LocalFrameUkmAggregator::~LocalFrameUkmAggregator() = default;
void LocalFrameUkmAggregator::TransmitFinalSample(int64_t source_id,
ukm::UkmRecorder* recorder,
bool is_for_main_frame) { … }
bool LocalFrameUkmAggregator::ShouldMeasureMetric(int64_t metric_id) const { … }
LocalFrameUkmAggregator::ScopedUkmHierarchicalTimer
LocalFrameUkmAggregator::GetScopedTimer(size_t metric_index) { … }
void LocalFrameUkmAggregator::BeginMainFrame() { … }
std::unique_ptr<cc::BeginMainFrameMetrics>
LocalFrameUkmAggregator::GetBeginMainFrameMetrics() { … }
void LocalFrameUkmAggregator::SetTickClockForTesting(
const base::TickClock* clock) { … }
void LocalFrameUkmAggregator::DidReachFirstContentfulPaint() { … }
void LocalFrameUkmAggregator::RecordTimerSample(size_t metric_index,
base::TimeTicks start,
base::TimeTicks end) { … }
void LocalFrameUkmAggregator::RecordCountSample(size_t metric_index,
int64_t count) { … }
void LocalFrameUkmAggregator::BeginForcedLayout() { … }
void LocalFrameUkmAggregator::RecordForcedLayoutSample(
DocumentUpdateReason reason,
base::TimeTicks start,
base::TimeTicks end) { … }
void LocalFrameUkmAggregator::RecordImplCompositorSample(
base::TimeTicks requested,
base::TimeTicks started,
base::TimeTicks completed) { … }
void LocalFrameUkmAggregator::RecordEndOfFrameMetrics(
base::TimeTicks start,
base::TimeTicks end,
cc::ActiveFrameSequenceTrackers trackers,
int64_t source_id,
ukm::UkmRecorder* recorder) { … }
void LocalFrameUkmAggregator::UpdateEventTimeAndUpdateSampleIfNeeded(
cc::ActiveFrameSequenceTrackers trackers) { … }
void LocalFrameUkmAggregator::UpdateSample(
cc::ActiveFrameSequenceTrackers trackers) { … }
void LocalFrameUkmAggregator::ReportPreFCPEvent(int64_t source_id,
ukm::UkmRecorder* recorder) { … }
void LocalFrameUkmAggregator::ReportUpdateTimeEvent(
int64_t source_id,
ukm::UkmRecorder* recorder) { … }
void LocalFrameUkmAggregator::ResetAllMetrics() { … }
void LocalFrameUkmAggregator::ChooseNextFrameForTest() { … }
void LocalFrameUkmAggregator::DoNotChooseNextFrameForTest() { … }
bool LocalFrameUkmAggregator::IsBeforeFCPForTesting() const { … }
void LocalFrameUkmAggregator::OnCommitRequested() { … }
}