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,
const int swap_end_latency_ms =
(frame_timing_details.swap_timings.swap_end - event_time)
.InMicroseconds();
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", 1);
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd", 1);
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", 2);
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd", 2);
histogram_tester.ExpectBucketCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", total_latency_ms,
1);
histogram_tester.ExpectBucketCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapEnd",
swap_end_latency_ms, 1);
histogram_tester.ExpectBucketCount(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", total_latency_ms,
2);
struct {
const char* name;
const int64_t latency_ms;
const int count;
} 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(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapEnd",
swap_end_latency_ms, 2);
expected_count.name, expected_count.latency_ms, expected_count.count);
}
}
// Tests that when the frame is not presented to the user, event latency metrics
......
......@@ -923,21 +923,39 @@ TEST_F(CompositorFrameReportingControllerTest,
SimulateSubmitCompositorFrame(*next_token_, {std::move(events_metrics), {}});
// Present the submitted compositor frame to the user.
const base::TimeTicks presentation_time = AdvanceNowByMs(10);
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);
// Verify that EventLatency histograms are recorded.
const int64_t latency_ms = (presentation_time - event_time).InMicroseconds();
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", 1);
histogram_tester.ExpectTotalCount(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", 2);
histogram_tester.ExpectBucketCount(
"EventLatency.GestureScrollBegin.Wheel.TotalLatency", latency_ms, 1);
const int64_t total_latency_ms =
(details.presentation_feedback.timestamp - event_time).InMicroseconds();
const int64_t swap_end_latency_ms =
(details.swap_timings.swap_end - event_time).InMicroseconds();
struct {
const char* name;
const int64_t latency_ms;
const int count;
} 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(
"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", latency_ms, 2);
expected_count.name, expected_count.latency_ms, expected_count.count);
}
}
// 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