Commit 8493f7e2 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Add more tests for gpu-swap-end EventLatency metrics

Update EventLatencyScrollForPresentedFrameReported in
CompositorFrameReportingControllerTest to test for
TotalLatencyToSwapEnd metric.

Bug: 1057193
Change-Id: I3cea912810138e6ec3ab6bdc10d3a4afb3016dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2137674Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762132}
parent fd6dee4e
...@@ -412,26 +412,26 @@ TEST_F(CompositorFrameReporterTest, ...@@ -412,26 +412,26 @@ TEST_F(CompositorFrameReporterTest,
const int swap_end_latency_ms = const int swap_end_latency_ms =
(frame_timing_details.swap_timings.swap_end - event_time) (frame_timing_details.swap_timings.swap_end - event_time)
.InMicroseconds(); .InMicroseconds();
histogram_tester.ExpectTotalCount( struct {
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", 1); const char* name;
histogram_tester.ExpectTotalCount( const int64_t latency_ms;
"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd", 1); const int count;
histogram_tester.ExpectTotalCount( } expected_counts[] = {
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", 2); {"EventLatency.GestureScrollBegin.Wheel.TotalLatency", total_latency_ms,
histogram_tester.ExpectTotalCount( 1},
"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd", 2); {"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd",
histogram_tester.ExpectBucketCount( swap_end_latency_ms, 1},
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", total_latency_ms, {"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", total_latency_ms,
1); 2},
histogram_tester.ExpectBucketCount( {"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd",
"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd", swap_end_latency_ms, 2},
swap_end_latency_ms, 1); };
histogram_tester.ExpectBucketCount( for (const auto& expected_count : expected_counts) {
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", total_latency_ms, histogram_tester.ExpectTotalCount(expected_count.name,
2); expected_count.count);
histogram_tester.ExpectBucketCount( histogram_tester.ExpectBucketCount(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd", expected_count.name, expected_count.latency_ms, expected_count.count);
swap_end_latency_ms, 2); }
} }
// Tests that when the frame is not presented to the user, event latency metrics // Tests that when the frame is not presented to the user, event latency metrics
......
...@@ -923,21 +923,39 @@ TEST_F(CompositorFrameReportingControllerTest, ...@@ -923,21 +923,39 @@ TEST_F(CompositorFrameReportingControllerTest,
SimulateSubmitCompositorFrame(*next_token_, {std::move(events_metrics), {}}); SimulateSubmitCompositorFrame(*next_token_, {std::move(events_metrics), {}});
// Present the submitted compositor frame to the user. // Present the submitted compositor frame to the user.
const base::TimeTicks presentation_time = AdvanceNowByMs(10);
viz::FrameTimingDetails details; viz::FrameTimingDetails details;
details.presentation_feedback.timestamp = presentation_time; details.received_compositor_frame_timestamp = AdvanceNowByMs(10);
details.draw_start_timestamp = AdvanceNowByMs(10);
details.swap_timings.swap_start = AdvanceNowByMs(10);
details.swap_timings.swap_end = AdvanceNowByMs(10);
details.presentation_feedback.timestamp = AdvanceNowByMs(10);
reporting_controller_.DidPresentCompositorFrame(*next_token_, details); reporting_controller_.DidPresentCompositorFrame(*next_token_, details);
// Verify that EventLatency histograms are recorded. // Verify that EventLatency histograms are recorded.
const int64_t latency_ms = (presentation_time - event_time).InMicroseconds(); const int64_t total_latency_ms =
histogram_tester.ExpectTotalCount( (details.presentation_feedback.timestamp - event_time).InMicroseconds();
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", 1); const int64_t swap_end_latency_ms =
histogram_tester.ExpectTotalCount( (details.swap_timings.swap_end - event_time).InMicroseconds();
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", 2); struct {
histogram_tester.ExpectBucketCount( const char* name;
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", latency_ms, 1); const int64_t latency_ms;
histogram_tester.ExpectBucketCount( const int count;
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", latency_ms, 2); } expected_counts[] = {
{"EventLatency.GestureScrollBegin.Wheel.TotalLatency", total_latency_ms,
1},
{"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd",
swap_end_latency_ms, 1},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", total_latency_ms,
2},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd",
swap_end_latency_ms, 2},
};
for (const auto& expected_count : expected_counts) {
histogram_tester.ExpectTotalCount(expected_count.name,
expected_count.count);
histogram_tester.ExpectBucketCount(
expected_count.name, expected_count.latency_ms, expected_count.count);
}
} }
// Tests that EventLatency histograms are not reported when the frame is dropped // Tests that EventLatency histograms are not reported when the frame is dropped
......
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