Commit 57c401a7 authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

[throughput] Report aggregated metrics to UKM.

Report the following aggregated to UKM, since these are the aggregation
of some of the other UKM metrics already reported:

  Graphics.Smoothness.Throughput.AllAnimations
  Graphics.Smoothness.Throughput.AllInteractions
  Graphics.Smoothness.Throughput.AllSequences

BUG=852482, 790761

Change-Id: I86d40ba677bd3b8e01e7b9a04b2787651f06d9d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2053843
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Auto-Submit: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743311}
parent 56c0277e
......@@ -179,11 +179,11 @@ void FrameSequenceMetrics::ReportMetrics() {
// Report the throughput metrics.
base::Optional<int> impl_throughput_percent = ThroughputData::ReportHistogram(
type_, ThreadType::kCompositor,
throughput_ukm_reporter_, type_, ThreadType::kCompositor,
GetIndexForMetric(FrameSequenceMetrics::ThreadType::kCompositor, type_),
impl_throughput_);
base::Optional<int> main_throughput_percent = ThroughputData::ReportHistogram(
type_, ThreadType::kMain,
throughput_ukm_reporter_, type_, ThreadType::kMain,
GetIndexForMetric(FrameSequenceMetrics::ThreadType::kMain, type_),
main_throughput_);
......@@ -204,7 +204,7 @@ void FrameSequenceMetrics::ReportMetrics() {
}
if (slower_throughput.has_value()) {
slower_throughput_percent = ThroughputData::ReportHistogram(
type_, ThreadType::kSlower,
throughput_ukm_reporter_, type_, ThreadType::kSlower,
GetIndexForMetric(FrameSequenceMetrics::ThreadType::kSlower, type_),
slower_throughput.value());
DCHECK(slower_throughput_percent.has_value())
......@@ -954,6 +954,7 @@ std::unique_ptr<FrameSequenceMetrics> FrameSequenceTracker::TakeMetrics() {
}
base::Optional<int> FrameSequenceMetrics::ThroughputData::ReportHistogram(
ThroughputUkmReporter* ukm_reporter,
FrameSequenceTrackerType sequence_type,
ThreadType thread_type,
int metric_index,
......@@ -987,16 +988,28 @@ base::Optional<int> FrameSequenceMetrics::ThroughputData::ReportHistogram(
if (is_animation) {
UMA_HISTOGRAM_PERCENTAGE(
"Graphics.Smoothness.PercentDroppedFrames.AllAnimations", percent);
if (ukm_reporter) {
ukm_reporter->ReportAggregateThroughput(AggregationType::kAllAnimations,
percent);
}
}
if (is_interaction) {
UMA_HISTOGRAM_PERCENTAGE(
"Graphics.Smoothness.PercentDroppedFrames.AllInteractions", percent);
if (ukm_reporter) {
ukm_reporter->ReportAggregateThroughput(AggregationType::kAllInteractions,
percent);
}
}
if (is_animation || is_interaction) {
UMA_HISTOGRAM_PERCENTAGE(
"Graphics.Smoothness.PercentDroppedFrames.AllSequences", percent);
if (ukm_reporter) {
ukm_reporter->ReportAggregateThroughput(AggregationType::kAllSequences,
percent);
}
}
if (!is_animation && !IsInteractionType(sequence_type) &&
......
......@@ -75,6 +75,7 @@ class CC_EXPORT FrameSequenceMetrics {
// Returns the throughput in percent, a return value of base::nullopt
// indicates that no throughput metric is reported.
static base::Optional<int> ReportHistogram(
ThroughputUkmReporter* ukm_reporter,
FrameSequenceTrackerType sequence_type,
ThreadType thread_type,
int metric_index,
......
......@@ -47,4 +47,15 @@ void ThroughputUkmReporter::ReportThroughputUkm(
samples_to_next_event_--;
}
void ThroughputUkmReporter::ReportAggregateThroughput(
AggregationType aggregation_type,
int throughput) {
if (samples_for_aggregated_report_ == 0) {
samples_for_aggregated_report_ = kNumberOfSamplesToReport;
ukm_manager_->RecordAggregateThroughput(aggregation_type, throughput);
}
DCHECK_GT(samples_for_aggregated_report_, 0u);
--samples_for_aggregated_report_;
}
} // namespace cc
......@@ -12,6 +12,12 @@
namespace cc {
class UkmManager;
enum class AggregationType {
kAllAnimations,
kAllInteractions,
kAllSequences,
};
// A helper class that takes throughput data from a FrameSequenceTracker and
// talk to UkmManager to report it.
class CC_EXPORT ThroughputUkmReporter {
......@@ -27,11 +33,15 @@ class CC_EXPORT ThroughputUkmReporter {
const base::Optional<int>& main_throughput_percent,
FrameSequenceTrackerType type);
void ReportAggregateThroughput(AggregationType aggregation_type,
int throughput);
private:
// Sampling control. We sample the event here to not throttle the UKM system.
// Currently, the same sampling rate is applied to all existing trackers. We
// might want to iterate on this based on the collected data.
uint32_t samples_to_next_event_ = 0;
uint32_t samples_for_aggregated_report_ = 0;
// This is pointing to the LayerTreeHostImpl::ukm_manager_, which is
// initialized right after the LayerTreeHostImpl is created. So when this
......
......@@ -4,6 +4,7 @@
#include "cc/trees/ukm_manager.h"
#include "cc/metrics/throughput_ukm_reporter.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
......@@ -169,6 +170,23 @@ void UkmManager::RecordThroughputUKM(
builder.Record(recorder_.get());
}
void UkmManager::RecordAggregateThroughput(AggregationType aggregation_type,
int64_t throughput_percent) const {
ukm::builders::Graphics_Smoothness_PercentDroppedFrames builder(source_id_);
switch (aggregation_type) {
case AggregationType::kAllAnimations:
builder.SetAllAnimations(throughput_percent);
break;
case AggregationType::kAllInteractions:
builder.SetAllInteractions(throughput_percent);
break;
case AggregationType::kAllSequences:
builder.SetAllSequences(throughput_percent);
break;
}
builder.Record(recorder_.get());
}
void UkmManager::RecordLatencyUKM(
CompositorFrameReporter::DroppedFrameReportType report_type,
const std::vector<CompositorFrameReporter::StageData>& stage_history,
......
......@@ -17,6 +17,8 @@ class UkmRecorder;
namespace cc {
enum class AggregationType;
class CC_EXPORT UkmRecorderFactory {
public:
virtual ~UkmRecorderFactory() {}
......@@ -44,6 +46,8 @@ class CC_EXPORT UkmManager {
void RecordThroughputUKM(FrameSequenceTrackerType tracker_type,
FrameSequenceMetrics::ThreadType thread_type,
int64_t throughput) const;
void RecordAggregateThroughput(AggregationType aggregation_type,
int64_t throughput_percent) const;
void RecordLatencyUKM(
CompositorFrameReporter::DroppedFrameReportType report_type,
const std::vector<CompositorFrameReporter::StageData>& stage_history,
......
......@@ -3981,6 +3981,51 @@ be describing additional metrics about the same event.
number of frames that were not displayed on screen (dropped). It is the
ratio of dropped over expected, converted to a percentage.
</summary>
<metric name="AllAnimations">
<summary>
Tracks the throughput of a particular sequence of frames for all
animations. This metric is reported for all animations (e.g.
comositor-driven animations, main-thread driven animations, and raf-driven
animations).
</summary>
<aggregation>
<history>
<index fields="profile.country"/>
<statistics>
<quantiles type="std-percentiles"/>
</statistics>
</history>
</aggregation>
</metric>
<metric name="AllInteractions">
<summary>
Tracks the throughput of a particular sequence of frames where a
user-input (e.g. scroll, pinch) is active. This metric is reported for all
sources of user-input (i.e. both touchscreen and touchpad/mouse-wheel).
</summary>
<aggregation>
<history>
<index fields="profile.country"/>
<statistics>
<quantiles type="std-percentiles"/>
</statistics>
</history>
</aggregation>
</metric>
<metric name="AllSequences">
<summary>
Tracks the throughput of a particular sequence of frames. This metric is
reported for all animations and all interactions.
</summary>
<aggregation>
<history>
<index fields="profile.country"/>
<statistics>
<quantiles type="std-percentiles"/>
</statistics>
</history>
</aggregation>
</metric>
<metric name="CompositorThread.CompositorAnimation">
<summary>
The throughput of the compositor thread during a compositor animation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment