Add new metrics to CompositionStats
This change adds fields for counting the total number of layers and used planes accross compositions. Change-Id: I7c2593f66f734a4f8ec8ddf7a2f6b5c0c8dc3cc3
This commit is contained in:
parent
48f056ff82
commit
68ff3baebe
4 changed files with 34 additions and 6 deletions
|
|
@ -402,6 +402,7 @@ auto HwcDisplay::PresentStagedComposition(
|
|||
CompositionAttributes attributes{.display_handle = handle_};
|
||||
CompositionStats stats{};
|
||||
++stats.total_frames;
|
||||
stats.layer_count += layers_.size();
|
||||
|
||||
// With multiple displays configured at different refresh rates,
|
||||
// desired_present_time can be up to almost 2 vsync periods away for the
|
||||
|
|
@ -450,13 +451,29 @@ auto HwcDisplay::PresentStagedComposition(
|
|||
}
|
||||
}
|
||||
|
||||
bool has_client = false;
|
||||
for (const auto &[id, layer] : layers_) {
|
||||
stats.total_pixops += layer.GetPixOps();
|
||||
if (layer.GetValidatedType() == CompositionType::kClient) {
|
||||
stats.gpu_pixops += layer.GetPixOps();
|
||||
switch (layer.GetValidatedType()) {
|
||||
case CompositionType::kClient:
|
||||
has_client = true;
|
||||
stats.gpu_pixops += layer.GetPixOps();
|
||||
break;
|
||||
case CompositionType::kDevice:
|
||||
case CompositionType::kCursor:
|
||||
++stats.used_plane_count;
|
||||
break;
|
||||
case CompositionType::kSolidColor:
|
||||
case CompositionType::kInvalid:
|
||||
ALOGE("Invalid layer type: %d",
|
||||
static_cast<int>(layer.GetValidatedType()));
|
||||
}
|
||||
}
|
||||
|
||||
if (has_client) {
|
||||
++stats.used_plane_count;
|
||||
}
|
||||
|
||||
if (!CommitStagedComposition(out_present_fence)) {
|
||||
attributes.present_failed = true;
|
||||
++stats.failed_kms_present;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ CompositionStats& CompositionStats::operator+=(const CompositionStats& other) {
|
|||
frames_flattened += other.frames_flattened;
|
||||
cursor_plane_frames += other.cursor_plane_frames;
|
||||
failed_kms_cursor_validate += other.failed_kms_cursor_validate;
|
||||
layer_count += other.layer_count;
|
||||
used_plane_count += other.used_plane_count;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +48,9 @@ CompositionStats operator-(const CompositionStats& a,
|
|||
a.failed_kms_present - b.failed_kms_present,
|
||||
a.frames_flattened - b.frames_flattened,
|
||||
a.cursor_plane_frames - b.cursor_plane_frames,
|
||||
a.failed_kms_cursor_validate - b.failed_kms_cursor_validate};
|
||||
a.failed_kms_cursor_validate - b.failed_kms_cursor_validate,
|
||||
a.layer_count - b.layer_count,
|
||||
a.used_plane_count - b.used_plane_count};
|
||||
}
|
||||
|
||||
void CompositionStatsTracker::ReportStats(const Callback& callback) {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ struct CompositionStats {
|
|||
uint32_t frames_flattened = 0;
|
||||
uint32_t cursor_plane_frames = 0;
|
||||
uint32_t failed_kms_cursor_validate = 0;
|
||||
uint32_t layer_count = 0;
|
||||
uint32_t used_plane_count = 0;
|
||||
|
||||
// When adding new stats, update the operator+= and operator- below as well as
|
||||
// operator== and operator<< which are implemented in the unit test file.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ static bool operator==(const CompositionStats& lhs,
|
|||
lhs.failed_kms_present == rhs.failed_kms_present &&
|
||||
lhs.frames_flattened == rhs.frames_flattened &&
|
||||
lhs.cursor_plane_frames == rhs.cursor_plane_frames &&
|
||||
lhs.failed_kms_cursor_validate == rhs.failed_kms_cursor_validate;
|
||||
lhs.failed_kms_cursor_validate == rhs.failed_kms_cursor_validate &&
|
||||
lhs.layer_count == rhs.layer_count &&
|
||||
lhs.used_plane_count == rhs.used_plane_count;
|
||||
}
|
||||
|
||||
// Stream insertion operator for better gtest failure messages.
|
||||
|
|
@ -63,7 +65,8 @@ static std::ostream& operator<<(std::ostream& os,
|
|||
<< ", frames_flattened: " << stats.frames_flattened
|
||||
<< ", cursor_plane_frames: " << stats.cursor_plane_frames
|
||||
<< ", failed_kms_cursor_validate: " << stats.failed_kms_cursor_validate
|
||||
<< " }";
|
||||
<< ", layer_count: " << stats.layer_count
|
||||
<< ", use_plane_count: " << stats.used_plane_count << " }";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +112,9 @@ class CompositionStatsTrackerTest : public ::testing::Test {
|
|||
.failed_kms_present = base / 20,
|
||||
.frames_flattened = base / 5,
|
||||
.cursor_plane_frames = base / 2,
|
||||
.failed_kms_cursor_validate = base / 50};
|
||||
.failed_kms_cursor_validate = base / 50,
|
||||
.layer_count = 2,
|
||||
.used_plane_count = 2};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue