Commit bdf70638 authored by Brian Sheedy's avatar Brian Sheedy Committed by Commit Bot

Switch wayland_client_perftests to histograms

Switches wayland_client_perftests to use PerfResultReporter instead of
PrintResult and whitelists it for conversion to histograms before
uploading to the perf dashboard.

Bug: 923564
Change-Id: Ie90b89386aafe88fe1b3274eda193237a2d328b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1988859
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728769}
parent 2a7b68bd
...@@ -3,15 +3,30 @@ ...@@ -3,15 +3,30 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "components/exo/wayland/clients/blur.h" #include "components/exo/wayland/clients/blur.h"
#include "components/exo/wayland/clients/simple.h" #include "components/exo/wayland/clients/simple.h"
#include "components/exo/wayland/clients/test/wayland_client_test.h" #include "components/exo/wayland/clients/test/wayland_client_test.h"
#include "testing/perf/perf_test.h" #include "testing/perf/perf_result_reporter.h"
namespace { namespace {
using WaylandClientPerfTests = exo::WaylandClientTest; using WaylandClientPerfTests = exo::WaylandClientTest;
constexpr char kMetricPrefixWaylandClient[] = "WaylandClient.";
constexpr char kMetricFramerate[] = "framerate";
constexpr char kMetricPresentationLatency[] = "presentation_latency";
constexpr char kStorySimple[] = "simple";
constexpr char kStoryPrefixBlurSigma[] = "blur_sigma_%d";
constexpr char kStoryPrefixBlurSigmaY[] = "blur_sigma_y_%d";
perf_test::PerfResultReporter SetUpReporter(const std::string& story) {
perf_test::PerfResultReporter reporter(kMetricPrefixWaylandClient, story);
reporter.RegisterImportantMetric(kMetricFramerate, "fps");
reporter.RegisterImportantMetric(kMetricPresentationLatency, "us");
return reporter;
}
// Test simple double-buffered client performance. // Test simple double-buffered client performance.
TEST_F(WaylandClientPerfTests, Simple) { TEST_F(WaylandClientPerfTests, Simple) {
const int kWarmUpFrames = 20; const int kWarmUpFrames = 20;
...@@ -32,15 +47,14 @@ TEST_F(WaylandClientPerfTests, Simple) { ...@@ -32,15 +47,14 @@ TEST_F(WaylandClientPerfTests, Simple) {
client.Run(kTestFrames, false, &feedback); client.Run(kTestFrames, false, &feedback);
auto time_delta = base::Time::Now() - start_time; auto time_delta = base::Time::Now() - start_time;
float fps = kTestFrames / time_delta.InSecondsF(); float fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "SimpleFrameRate", fps, auto reporter = SetUpReporter(kStorySimple);
"frames/s", true); reporter.AddResult(kMetricFramerate, fps);
auto average_latency = auto average_latency =
feedback.num_frames_presented feedback.num_frames_presented
? feedback.total_presentation_latency / feedback.num_frames_presented ? feedback.total_presentation_latency / feedback.num_frames_presented
: base::TimeDelta::Max(); : base::TimeDelta::Max();
perf_test::PrintResult( reporter.AddResult(kMetricPresentationLatency, average_latency);
"WaylandClientPerfTests", "", "SimplePresentationLatency",
static_cast<size_t>(average_latency.InMicroseconds()), "us", true);
} }
class WaylandClientBlurPerfTests class WaylandClientBlurPerfTests
...@@ -74,40 +88,16 @@ TEST_P(WaylandClientBlurPerfTests, BlurSigma) { ...@@ -74,40 +88,16 @@ TEST_P(WaylandClientBlurPerfTests, BlurSigma) {
client.Run(0, 0, 0, false, kWarmUpFrames); client.Run(0, 0, 0, false, kWarmUpFrames);
constexpr int blur_values[] = {0, 5, 15, 30, 50};
for (int bv : blur_values) {
auto start_time = base::Time::Now(); auto start_time = base::Time::Now();
client.Run(0, 0, max_sigma(), kOffscreen, kTestFrames); client.Run(bv, bv, max_sigma(), kOffscreen, kTestFrames);
auto time_delta = base::Time::Now() - start_time; auto time_delta = base::Time::Now() - start_time;
float fps = kTestFrames / time_delta.InSecondsF(); float fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigma0", fps, SetUpReporter(base::StringPrintf(kStoryPrefixBlurSigma, bv))
"frames/s", true); .AddResult(kMetricFramerate, fps);
}
start_time = base::Time::Now();
client.Run(5, 5, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigma5", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(15, 15, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigma15", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(30, 30, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigma30", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(50, 50, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigma50", fps,
"frames/s", true);
} }
TEST_P(WaylandClientBlurPerfTests, BlurSigmaY) { TEST_P(WaylandClientBlurPerfTests, BlurSigmaY) {
...@@ -124,40 +114,16 @@ TEST_P(WaylandClientBlurPerfTests, BlurSigmaY) { ...@@ -124,40 +114,16 @@ TEST_P(WaylandClientBlurPerfTests, BlurSigmaY) {
client.Run(0, 0, 0, false, kWarmUpFrames); client.Run(0, 0, 0, false, kWarmUpFrames);
constexpr int blur_values[] = {0, 5, 10, 25, 50};
for (int bv : blur_values) {
auto start_time = base::Time::Now(); auto start_time = base::Time::Now();
client.Run(0, 0, max_sigma(), kOffscreen, kTestFrames); client.Run(0, bv, max_sigma(), kOffscreen, kTestFrames);
auto time_delta = base::Time::Now() - start_time; auto time_delta = base::Time::Now() - start_time;
float fps = kTestFrames / time_delta.InSecondsF(); float fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigmaY0", fps, SetUpReporter(base::StringPrintf(kStoryPrefixBlurSigmaY, bv))
"frames/s", true); .AddResult(kMetricFramerate, fps);
}
start_time = base::Time::Now();
client.Run(0, 5, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigmaY5", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(0, 10, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigmaY10", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(0, 25, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigmaY25", fps,
"frames/s", true);
start_time = base::Time::Now();
client.Run(0, 50, max_sigma(), kOffscreen, kTestFrames);
time_delta = base::Time::Now() - start_time;
fps = kTestFrames / time_delta.InSecondsF();
perf_test::PrintResult("WaylandClientPerfTests", "", "BlurSigmaY50", fps,
"frames/s", true);
} }
} // namespace } // namespace
...@@ -107,6 +107,7 @@ GTEST_CONVERSION_WHITELIST = [ ...@@ -107,6 +107,7 @@ GTEST_CONVERSION_WHITELIST = [
'validating_command_buffer_perftests', 'validating_command_buffer_perftests',
'views_perftests', 'views_perftests',
'viz_perftests', 'viz_perftests',
'wayland_client_perftests',
'xr.vr.common_perftests', 'xr.vr.common_perftests',
] ]
......
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