#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/metrics/frame_sequence_metrics.h"
#include <memory>
#include <string>
#include <utility>
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "cc/metrics/frame_sequence_tracker.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
namespace cc {
SmoothEffectDrivingThread;
bool ShouldReportForAnimation(FrameSequenceTrackerType sequence_type,
SmoothEffectDrivingThread thread_type) { … }
bool ShouldReportForInteraction(
FrameSequenceTrackerType sequence_type,
SmoothEffectDrivingThread reporting_thread_type,
SmoothEffectDrivingThread metrics_effective_thread_type) { … }
namespace {
constexpr uint32_t kMaxNoUpdateFrameCount = …;
const char* GetThreadTypeName(SmoothEffectDrivingThread type) { … }
constexpr int kMinFramesForThroughputMetric = …;
constexpr int kBuiltinSequenceNum = …;
constexpr int kMaximumHistogramIndex = …;
constexpr int kMaximumJankV3HistogramIndex = …;
int GetIndexForMetric(SmoothEffectDrivingThread thread_type,
FrameSequenceTrackerType type) { … }
int GetIndexForJankV3Metric(SmoothEffectDrivingThread thread_type,
FrameSequenceTrackerType type) { … }
std::string GetCheckerboardingV3HistogramName(FrameSequenceTrackerType type) { … }
std::string GetCheckerboardingV4HistogramName(FrameSequenceTrackerType type) { … }
std::string GetCheckerboardingV3ThreadedHistogramName(
FrameSequenceTrackerType type,
const char* thread_name) { … }
std::string GetJankV3HistogramName(FrameSequenceTrackerType type,
const char* thread_name) { … }
std::string GetThroughputV3HistogramName(FrameSequenceTrackerType type,
const char* thread_name) { … }
}
FrameSequenceMetrics::V3::V3() = default;
FrameSequenceMetrics::V3::~V3() = default;
FrameSequenceMetrics::CustomReportData::CustomReportData(
uint32_t frames_expected,
uint32_t frames_dropped,
uint32_t jank_count,
std::vector<Jank> janks)
: … { … }
FrameSequenceMetrics::CustomReportData::CustomReportData() = default;
FrameSequenceMetrics::CustomReportData::CustomReportData(
const CustomReportData&) = default;
FrameSequenceMetrics::CustomReportData&
FrameSequenceMetrics::CustomReportData::operator=(const CustomReportData&) =
default;
FrameSequenceMetrics::CustomReportData::~CustomReportData() = default;
FrameSequenceMetrics::FrameSequenceMetrics(FrameSequenceTrackerType type)
: … { … }
FrameSequenceMetrics::~FrameSequenceMetrics() { … }
void FrameSequenceMetrics::ReportLeftoverData() { … }
void FrameSequenceMetrics::SetScrollingThread(
SmoothEffectDrivingThread scrolling_thread) { … }
void FrameSequenceMetrics::SetCustomReporter(CustomReporter custom_reporter) { … }
SmoothEffectDrivingThread FrameSequenceMetrics::GetEffectiveThread() const { … }
void FrameSequenceMetrics::Merge(
std::unique_ptr<FrameSequenceMetrics> metrics) { … }
bool FrameSequenceMetrics::HasEnoughDataForReporting() const { … }
bool FrameSequenceMetrics::HasDataLeftForReporting() const { … }
void FrameSequenceMetrics::AdoptTrace(FrameSequenceMetrics* adopt_from) { … }
void FrameSequenceMetrics::ReportMetrics() { … }
FrameSequenceMetrics::TraceData::TraceData(FrameSequenceMetrics* m)
: … { … }
FrameSequenceMetrics::TraceData::~TraceData() = default;
void FrameSequenceMetrics::TraceData::Terminate(
const V3& v3,
const V4& v4,
FrameInfo::SmoothEffectDrivingThread effective_thread) { … }
void FrameSequenceMetrics::TraceData::Advance(base::TimeTicks start_timestamp,
base::TimeTicks new_timestamp,
uint32_t expected,
uint32_t dropped,
uint64_t sequence_number,
const char* histogram_name) { … }
void FrameSequenceMetrics::AddSortedFrame(const viz::BeginFrameArgs& args,
const FrameInfo& frame_info) { … }
void FrameSequenceMetrics::CalculateJankV3(
const viz::BeginFrameArgs& args,
const FrameInfo& frame_info,
FrameInfo::FrameFinalState final_state,
base::TimeTicks last_presented_termination_time,
base::TimeTicks termination_time) { … }
void FrameSequenceMetrics::CalculateCheckerboarding(
const FrameInfo& frame_info,
FrameInfo::FrameFinalState final_state) { … }
void FrameSequenceMetrics::IncrementJankIdleTimeV3(
base::TimeTicks last_presented_termination_time,
base::TimeTicks termination_time) { … }
void FrameSequenceMetrics::TraceJankV3(uint64_t sequence_number,
base::TimeTicks last_termination_time,
base::TimeTicks termination_time) { … }
}