Switch viz_perftests to histograms
Changes use of PrintResult to PerfResultReporter in viz_perftests and whitelists the tests for conversion to histograms before uploading to the perf dashboard. Bug: 923564 Change-Id: I078c3094ca44c41b7a33c205a22b8017c3068975 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815341 Reviewed-by: weiliangc <weiliangc@chromium.org> Commit-Queue: Brian Sheedy <bsheedy@chromium.org> Cr-Commit-Position: refs/heads/master@{#698521}
This commit is contained in:
components/viz
common
service
tools/perf
@ -11,7 +11,7 @@
|
||||
#include "components/viz/common/quads/render_pass.h"
|
||||
#include "components/viz/common/quads/texture_draw_quad.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
#include "third_party/skia/include/core/SkBlendMode.h"
|
||||
|
||||
namespace viz {
|
||||
@ -21,6 +21,15 @@ static const int kTimeLimitMillis = 2000;
|
||||
static const int kWarmupRuns = 5;
|
||||
static const int kTimeCheckInterval = 10;
|
||||
|
||||
constexpr char kMetricPrefixDrawQuad[] = "DrawQuad.";
|
||||
constexpr char kMetricIterateResourcesRunsPerS[] = "iterate_resources";
|
||||
|
||||
perf_test::PerfResultReporter SetUpDrawQuadReporter(const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixDrawQuad, story);
|
||||
reporter.RegisterImportantMetric(kMetricIterateResourcesRunsPerS, "runs/s");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) {
|
||||
gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
|
||||
gfx::Rect content_rect(26, 28);
|
||||
@ -82,7 +91,7 @@ class DrawQuadPerfTest : public testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void RunIterateResourceTest(const std::string& test_name, int quad_count) {
|
||||
void RunIterateResourceTest(const std::string& story, int quad_count) {
|
||||
CreateRenderPass();
|
||||
std::vector<DrawQuad*> quads;
|
||||
GenerateTextureDrawQuads(quad_count, &quads);
|
||||
@ -96,8 +105,8 @@ class DrawQuadPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult("draw_quad_iterate_resources", "", test_name,
|
||||
timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpDrawQuadReporter(story);
|
||||
reporter.AddResult(kMetricIterateResourcesRunsPerS, timer_.LapsPerSecond());
|
||||
CleanUpRenderPass();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "components/viz/service/display/bsp_tree.h"
|
||||
#include "components/viz/service/display/draw_polygon.h"
|
||||
#include "components/viz/test/paths.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
|
||||
namespace viz {
|
||||
namespace {
|
||||
@ -34,6 +34,15 @@ static const int kTimeLimitMillis = 2000;
|
||||
static const int kWarmupRuns = 5;
|
||||
static const int kTimeCheckInterval = 10;
|
||||
|
||||
const char kMetricPrefixBspTree[] = "BspTree.";
|
||||
const char kMetricCalcDrawPropsTimeUs[] = "calc_draw_props_time";
|
||||
|
||||
perf_test::PerfResultReporter SetUpBspTreeReporter(const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixBspTree, story);
|
||||
reporter.RegisterImportantMetric(kMetricCalcDrawPropsTimeUs, "us");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
class BspTreePerfTest : public cc::LayerTreeTest {
|
||||
public:
|
||||
BspTreePerfTest()
|
||||
@ -52,7 +61,7 @@ class BspTreePerfTest : public cc::LayerTreeTest {
|
||||
content_layer_client_.set_bounds(viewport);
|
||||
}
|
||||
|
||||
void SetTestName(const std::string& name) { test_name_ = name; }
|
||||
void SetStory(const std::string& story) { story_ = story; }
|
||||
|
||||
void SetNumberOfDuplicates(int num_duplicates) {
|
||||
num_duplicates_ = num_duplicates;
|
||||
@ -109,55 +118,56 @@ class BspTreePerfTest : public cc::LayerTreeTest {
|
||||
}
|
||||
|
||||
void AfterTest() override {
|
||||
CHECK(!test_name_.empty()) << "Must SetTestName() before TearDown().";
|
||||
perf_test::PrintResult("calc_draw_props_time", "", test_name_,
|
||||
timer_.TimePerLap().InMicrosecondsF(), "us", true);
|
||||
CHECK(!story_.empty()) << "Must SetStory() before TearDown().";
|
||||
auto reporter = SetUpBspTreeReporter(story_);
|
||||
reporter.AddResult(kMetricCalcDrawPropsTimeUs,
|
||||
timer_.TimePerLap().InMicrosecondsF());
|
||||
}
|
||||
|
||||
private:
|
||||
cc::FakeContentLayerClient content_layer_client_;
|
||||
base::LapTimer timer_;
|
||||
std::string test_name_;
|
||||
std::string story_;
|
||||
std::string json_;
|
||||
cc::LayerImplList base_list_;
|
||||
int num_duplicates_ = 1;
|
||||
};
|
||||
|
||||
TEST_F(BspTreePerfTest, LayerSorterCubes) {
|
||||
SetTestName("layer_sort_cubes");
|
||||
SetStory("layer_sort_cubes");
|
||||
ReadTestFile("layer_sort_cubes");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
}
|
||||
|
||||
TEST_F(BspTreePerfTest, LayerSorterRubik) {
|
||||
SetTestName("layer_sort_rubik");
|
||||
SetStory("layer_sort_rubik");
|
||||
ReadTestFile("layer_sort_rubik");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
}
|
||||
|
||||
TEST_F(BspTreePerfTest, BspTreeCubes) {
|
||||
SetTestName("bsp_tree_cubes");
|
||||
SetStory("bsp_tree_cubes");
|
||||
SetNumberOfDuplicates(1);
|
||||
ReadTestFile("layer_sort_cubes");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
}
|
||||
|
||||
TEST_F(BspTreePerfTest, BspTreeRubik) {
|
||||
SetTestName("bsp_tree_rubik");
|
||||
SetStory("bsp_tree_rubik");
|
||||
SetNumberOfDuplicates(1);
|
||||
ReadTestFile("layer_sort_rubik");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
}
|
||||
|
||||
TEST_F(BspTreePerfTest, BspTreeCubes_2) {
|
||||
SetTestName("bsp_tree_cubes_2");
|
||||
SetStory("bsp_tree_cubes_2");
|
||||
SetNumberOfDuplicates(2);
|
||||
ReadTestFile("layer_sort_cubes");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
}
|
||||
|
||||
TEST_F(BspTreePerfTest, BspTreeCubes_4) {
|
||||
SetTestName("bsp_tree_cubes_4");
|
||||
SetStory("bsp_tree_cubes_4");
|
||||
SetNumberOfDuplicates(4);
|
||||
ReadTestFile("layer_sort_cubes");
|
||||
RunTest(cc::CompositorMode::SINGLE_THREADED);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
|
||||
#include "components/viz/test/fake_output_surface.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
|
||||
namespace viz {
|
||||
namespace {
|
||||
@ -32,6 +32,25 @@ static const int kTimeCheckInterval = 10;
|
||||
static const int kHeight = 1000;
|
||||
static const int kWidth = 1000;
|
||||
|
||||
constexpr char kMetricPrefixRemoveOverdrawQuad[] = "RemoveOverdrawQuad.";
|
||||
constexpr char kMetricOverlapThroughputRunsPerS[] = "overlap_throughput";
|
||||
constexpr char kMetricIsolatedThroughputRunsPerS[] = "isolated_throughput";
|
||||
constexpr char kMetricPartialOverlapThroughputRunsPerS[] =
|
||||
"partial_overlap_throughput";
|
||||
constexpr char kMetricAdjacentThroughputRunsPerS[] = "adjacent_throughput";
|
||||
|
||||
perf_test::PerfResultReporter SetUpRemoveOverdrawQuadReporter(
|
||||
const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixRemoveOverdrawQuad,
|
||||
story);
|
||||
reporter.RegisterImportantMetric(kMetricOverlapThroughputRunsPerS, "runs/s");
|
||||
reporter.RegisterImportantMetric(kMetricIsolatedThroughputRunsPerS, "runs/s");
|
||||
reporter.RegisterImportantMetric(kMetricPartialOverlapThroughputRunsPerS,
|
||||
"runs/s");
|
||||
reporter.RegisterImportantMetric(kMetricAdjacentThroughputRunsPerS, "runs/s");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
public:
|
||||
RemoveOverdrawQuadPerfTest()
|
||||
@ -113,7 +132,7 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
// +--------+
|
||||
// | s1/2/3 |
|
||||
// +--------+
|
||||
void IterateOverlapShareQuadStates(const std::string& test_name,
|
||||
void IterateOverlapShareQuadStates(const std::string& story,
|
||||
int shared_quad_state_count,
|
||||
int quad_count) {
|
||||
frame_.render_pass_list.push_back(RenderPass::Create());
|
||||
@ -126,9 +145,9 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult(
|
||||
"RemoveOverdrawDraws Iterates overlap ShareQuadStates: ", "", test_name,
|
||||
timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpRemoveOverdrawQuadReporter(story);
|
||||
reporter.AddResult(kMetricOverlapThroughputRunsPerS,
|
||||
timer_.LapsPerSecond());
|
||||
frame_ = CompositorFrame();
|
||||
}
|
||||
|
||||
@ -154,7 +173,7 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
// +---+---+
|
||||
// |s3 |
|
||||
// +---+
|
||||
void IterateIsolatedSharedQuadStates(const std::string& test_name,
|
||||
void IterateIsolatedSharedQuadStates(const std::string& story,
|
||||
int shared_quad_state_count,
|
||||
int quad_count) {
|
||||
frame_.render_pass_list.push_back(RenderPass::Create());
|
||||
@ -166,9 +185,9 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult(
|
||||
"RemoveOverdrawDraws Iterates isolated SharedQuadStates: ", "",
|
||||
test_name, timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpRemoveOverdrawQuadReporter(story);
|
||||
reporter.AddResult(kMetricIsolatedThroughputRunsPerS,
|
||||
timer_.LapsPerSecond());
|
||||
frame_ = CompositorFrame();
|
||||
}
|
||||
|
||||
@ -201,12 +220,12 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
// +--| | |
|
||||
// +--| |
|
||||
// +----+
|
||||
void IteratePatriallyOverlapSharedQuadStates(const std::string& test_name,
|
||||
void IteratePartiallyOverlapSharedQuadStates(const std::string& story,
|
||||
int shared_quad_state_count,
|
||||
float percentage_overlap,
|
||||
int quad_count) {
|
||||
frame_.render_pass_list.push_back(RenderPass::Create());
|
||||
CreatePatriallyOverlapSharedQuadStates(shared_quad_state_count,
|
||||
CreatePartiallyOverlapSharedQuadStates(shared_quad_state_count,
|
||||
percentage_overlap, quad_count);
|
||||
std::unique_ptr<Display> display = CreateDisplay();
|
||||
timer_.Reset();
|
||||
@ -215,13 +234,13 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult(
|
||||
"RemoveOverdrawDraws Iterates patrially overlap SharedQuadStates: ", "",
|
||||
test_name, timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpRemoveOverdrawQuadReporter(story);
|
||||
reporter.AddResult(kMetricPartialOverlapThroughputRunsPerS,
|
||||
timer_.LapsPerSecond());
|
||||
frame_ = CompositorFrame();
|
||||
}
|
||||
|
||||
void CreatePatriallyOverlapSharedQuadStates(int shared_quad_state_count,
|
||||
void CreatePartiallyOverlapSharedQuadStates(int shared_quad_state_count,
|
||||
float percentage_overlap,
|
||||
int quad_count) {
|
||||
int shared_quad_state_height =
|
||||
@ -249,7 +268,7 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
// +----+----+
|
||||
// | s2 | s4 |
|
||||
// +----+----+
|
||||
void IterateAdjacentSharedQuadStates(const std::string& test_name,
|
||||
void IterateAdjacentSharedQuadStates(const std::string& story,
|
||||
int shared_quad_state_count,
|
||||
int quad_count) {
|
||||
frame_.render_pass_list.push_back(RenderPass::Create());
|
||||
@ -262,9 +281,9 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult(
|
||||
"RemoveOverdrawDraws Iterates adjacent SharedQuadStates: ", "",
|
||||
test_name, timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpRemoveOverdrawQuadReporter(story);
|
||||
reporter.AddResult(kMetricAdjacentThroughputRunsPerS,
|
||||
timer_.LapsPerSecond());
|
||||
frame_ = CompositorFrame();
|
||||
}
|
||||
|
||||
@ -298,31 +317,31 @@ class RemoveOverdrawQuadPerfTest : public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(RemoveOverdrawQuadPerfTest, IterateOverlapShareQuadStates) {
|
||||
IterateOverlapShareQuadStates("4 sqs with 4 quads in each", 2, 2);
|
||||
IterateOverlapShareQuadStates("4 sqs with 100 quads in each", 2, 10);
|
||||
IterateOverlapShareQuadStates("100 sqs with 4 quads in each", 10, 2);
|
||||
IterateOverlapShareQuadStates("100 sqs with 100 quads in each", 10, 10);
|
||||
IterateOverlapShareQuadStates("4_sqs_with_4_quads", 2, 2);
|
||||
IterateOverlapShareQuadStates("4_sqs_with_100_quads", 2, 10);
|
||||
IterateOverlapShareQuadStates("100_sqs_with_4_quads", 10, 2);
|
||||
IterateOverlapShareQuadStates("100_sqs_with_100_quads", 10, 10);
|
||||
}
|
||||
|
||||
TEST_F(RemoveOverdrawQuadPerfTest, IterateIsolatedSharedQuadStates) {
|
||||
IterateIsolatedSharedQuadStates("2 sqs with 4 quads", 2, 2);
|
||||
IterateIsolatedSharedQuadStates("4 sqs with 100 quads", 2, 10);
|
||||
IterateIsolatedSharedQuadStates("10 sqs with 4 quads", 10, 2);
|
||||
IterateIsolatedSharedQuadStates("10 sqs with 100 quads", 10, 10);
|
||||
IterateIsolatedSharedQuadStates("2_sqs_with_4_quads", 2, 2);
|
||||
IterateIsolatedSharedQuadStates("4_sqs_with_100_quads", 2, 10);
|
||||
IterateIsolatedSharedQuadStates("10_sqs_with_4_quads", 10, 2);
|
||||
IterateIsolatedSharedQuadStates("10_sqs_with_100_quads", 10, 10);
|
||||
}
|
||||
|
||||
TEST_F(RemoveOverdrawQuadPerfTest, IteratePatriallyOverlapSharedQuadStates) {
|
||||
IteratePatriallyOverlapSharedQuadStates("2 sqs with 4 quads", 2, 0.5, 2);
|
||||
IteratePatriallyOverlapSharedQuadStates("10 sqs with 100 quads", 2, 0.5, 10);
|
||||
IteratePatriallyOverlapSharedQuadStates("2 sqs with 4 quads", 10, 0.5, 2);
|
||||
IteratePatriallyOverlapSharedQuadStates("10 sqs with 100 quads", 10, 0.5, 10);
|
||||
TEST_F(RemoveOverdrawQuadPerfTest, IteratePartiallyOverlapSharedQuadStates) {
|
||||
IteratePartiallyOverlapSharedQuadStates("2_sqs_with_4_quads", 2, 0.5, 2);
|
||||
IteratePartiallyOverlapSharedQuadStates("10_sqs_with_100 quads", 2, 0.5, 10);
|
||||
IteratePartiallyOverlapSharedQuadStates("2_sqs_with_4_quads", 10, 0.5, 2);
|
||||
IteratePartiallyOverlapSharedQuadStates("10_sqs_with_100_quads", 10, 0.5, 10);
|
||||
}
|
||||
|
||||
TEST_F(RemoveOverdrawQuadPerfTest, IterateAdjacentSharedQuadStates) {
|
||||
IterateAdjacentSharedQuadStates("4 sqs with 4 quads", 2, 2);
|
||||
IterateAdjacentSharedQuadStates("4 sqs with 100 quads", 2, 10);
|
||||
IterateAdjacentSharedQuadStates("100 sqs with 4 quads", 10, 2);
|
||||
IterateAdjacentSharedQuadStates("100 sqs with 100 quads", 10, 10);
|
||||
IterateAdjacentSharedQuadStates("4_sqs_with_4_quads", 2, 2);
|
||||
IterateAdjacentSharedQuadStates("4_sqs_with_100_quads", 2, 10);
|
||||
IterateAdjacentSharedQuadStates("100_sqs_with_4_quads", 10, 2);
|
||||
IterateAdjacentSharedQuadStates("100_sqs_with_100_quads", 10, 10);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "components/viz/test/test_in_process_context_provider.h"
|
||||
#include "gpu/command_buffer/client/gles2_interface.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/gfx/color_space.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
@ -40,6 +40,16 @@ constexpr gfx::Rect kRequestArea = gfx::Rect(kSourceSize.width() / 2,
|
||||
kSourceSize.width() / 4,
|
||||
kSourceSize.height() / 4);
|
||||
|
||||
constexpr char kMetricPrefixGLRendererCopier[] = "GLRendererCopier.";
|
||||
constexpr char kMetricReadbackThroughputRunsPerS[] = "readback_throughput";
|
||||
|
||||
perf_test::PerfResultReporter SetUpGLRendererCopierReporter(
|
||||
const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixGLRendererCopier, story);
|
||||
reporter.RegisterImportantMetric(kMetricReadbackThroughputRunsPerS, "runs/s");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
base::FilePath GetTestFilePath(const base::FilePath::CharType* basename) {
|
||||
base::FilePath test_dir;
|
||||
base::PathService::Get(Paths::DIR_TEST_DATA, &test_dir);
|
||||
@ -162,7 +172,7 @@ class GLRendererCopierPerfTest : public testing::Test {
|
||||
CopyOutputResult::Format result_format,
|
||||
bool scale_by_half,
|
||||
bool flipped_source,
|
||||
const std::string& test_name) {
|
||||
const std::string& story) {
|
||||
std::unique_ptr<CopyOutputResult> result;
|
||||
|
||||
gfx::Rect result_selection(kRequestArea);
|
||||
@ -241,8 +251,9 @@ class GLRendererCopierPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult("GLRendererCopier readback ", "", test_name,
|
||||
timer_.LapsPerSecond(), "runs/s", true);
|
||||
auto reporter = SetUpGLRendererCopierReporter(story);
|
||||
reporter.AddResult(kMetricReadbackThroughputRunsPerS,
|
||||
timer_.LapsPerSecond());
|
||||
}
|
||||
|
||||
private:
|
||||
@ -262,7 +273,7 @@ TEST_F(GLRendererCopierPerfTest, NoTransformNoNewTextures) {
|
||||
CopyFromTextureOrFramebuffer(
|
||||
/*have_source_texture=*/false, CopyOutputResult::Format::RGBA_BITMAP,
|
||||
/*scale_by_half=*/false, /*flipped_source=*/false,
|
||||
"no transformation and no new textures ");
|
||||
"no_transformation_and_no_new_textures");
|
||||
}
|
||||
|
||||
// Source texture is the one attached to the framebuffer, better performance
|
||||
@ -271,19 +282,19 @@ TEST_F(GLRendererCopierPerfTest, HaveTextureResultRGBABitmap) {
|
||||
CopyFromTextureOrFramebuffer(
|
||||
/*have_source_texture=*/true, CopyOutputResult::Format::RGBA_BITMAP,
|
||||
/*scale_by_half=*/true, /*flipped_source=*/false,
|
||||
"framebuffer has texture and result is RGBA_BITMAP ");
|
||||
"framebuffer_has_texture_and_result_is_RGBA_BITMAP");
|
||||
}
|
||||
TEST_F(GLRendererCopierPerfTest, HaveTextureResultRGBATexture) {
|
||||
CopyFromTextureOrFramebuffer(
|
||||
/*have_source_texture=*/true, CopyOutputResult::Format::RGBA_TEXTURE,
|
||||
/*scale_by_half=*/true, /*flipped_source=*/false,
|
||||
"framebuffer has texture and result is RGBA_TEXTURE ");
|
||||
"framebuffer_has_texture_and_result_is_RGBA_TEXTURE");
|
||||
}
|
||||
TEST_F(GLRendererCopierPerfTest, HaveTextureResultI420Planes) {
|
||||
CopyFromTextureOrFramebuffer(
|
||||
/*have_source_texture=*/true, CopyOutputResult::Format::I420_PLANES,
|
||||
/*scale_by_half=*/true, /*flipped_source=*/false,
|
||||
"framebuffer has texture and result is I420_PLANES ");
|
||||
"framebuffer_has_texture_and_result_is_I420_PLANES");
|
||||
}
|
||||
|
||||
// Have to make a copy of the framebuffer for the source texture.
|
||||
@ -291,7 +302,7 @@ TEST_F(GLRendererCopierPerfTest, NoTextureResultI420Planes) {
|
||||
CopyFromTextureOrFramebuffer(
|
||||
/*have_source_texture=*/false, CopyOutputResult::Format::I420_PLANES,
|
||||
/*scale_by_half=*/true, /*flipped_source=*/false,
|
||||
"framebuffer doesn't have texture and result is I420_PLANES ");
|
||||
"framebuffer_doesn't_have_texture_and_result_is_I420_PLANES");
|
||||
}
|
||||
|
||||
// Source content is vertically flipped.
|
||||
@ -299,7 +310,7 @@ TEST_F(GLRendererCopierPerfTest, SourceContentVerticallyFlipped) {
|
||||
CopyFromTextureOrFramebuffer(/*have_source_texture=*/true,
|
||||
CopyOutputResult::Format::I420_PLANES,
|
||||
/*scale_by_half=*/true, /*flipped_source=*/true,
|
||||
"source content is vertically flipped ");
|
||||
"source_content_is_vertically_flipped");
|
||||
}
|
||||
|
||||
// Result is not scaled by half.
|
||||
@ -307,7 +318,7 @@ TEST_F(GLRendererCopierPerfTest, ResultNotScaled) {
|
||||
CopyFromTextureOrFramebuffer(/*have_source_texture=*/true,
|
||||
CopyOutputResult::Format::I420_PLANES,
|
||||
/*scale_by_half=*/false, /*flipped_source=*/true,
|
||||
"result is not scaled by half ");
|
||||
"result_is_not_scaled_by_half");
|
||||
}
|
||||
|
||||
} // namespace viz
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "gpu/command_buffer/client/shared_image_interface.h"
|
||||
#include "gpu/command_buffer/common/shared_image_usage.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
#include "third_party/skia/include/core/SkColorPriv.h"
|
||||
#include "ui/gfx/color_space.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
@ -61,6 +61,15 @@ static constexpr FrameSinkId kArbitraryFrameSinkId(3, 3);
|
||||
static constexpr gfx::Size kSurfaceSize(1000, 1000);
|
||||
static constexpr gfx::Rect kSurfaceRect(kSurfaceSize);
|
||||
|
||||
constexpr char kMetricPrefixRenderer[] = "Renderer.";
|
||||
constexpr char kMetricFps[] = "frames_per_second";
|
||||
|
||||
perf_test::PerfResultReporter SetUpRendererReporter(const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixRenderer, story);
|
||||
reporter.RegisterImportantMetric(kMetricFps, "fps");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
base::TimeDelta TestTimeLimit() {
|
||||
static const char kPerfTestTimeMillis[] = "perf-test-time-ms";
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
@ -278,8 +287,11 @@ class RendererPerfTest : public testing::Test {
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
perf_test::PrintResult("Can draw", "", "frames", timer_.LapsPerSecond(),
|
||||
"runs/s", true);
|
||||
std::string story =
|
||||
renderer_settings_.use_skia_renderer ? "SkiaRenderer_" : "GLRenderer_";
|
||||
story += ::testing::UnitTest::GetInstance()->current_test_info()->name();
|
||||
auto reporter = SetUpRendererReporter(story);
|
||||
reporter.AddResult(kMetricFps, timer_.LapsPerSecond());
|
||||
|
||||
auto* histogram = base::StatisticsRecorder::FindHistogram(
|
||||
"Compositing.Display.DrawToSwapUs");
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "components/viz/test/compositor_frame_helpers.h"
|
||||
#include "components/viz/test/test_context_provider.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "testing/perf/perf_result_reporter.h"
|
||||
|
||||
namespace viz {
|
||||
namespace {
|
||||
@ -26,6 +26,16 @@ constexpr bool kIsRoot = true;
|
||||
constexpr bool kIsChildRoot = false;
|
||||
constexpr bool kNeedsSyncPoints = true;
|
||||
|
||||
constexpr char kMetricPrefixSurfaceAggregator[] = "SurfaceAggregator.";
|
||||
constexpr char kMetricSpeedRunsPerS[] = "speed";
|
||||
|
||||
perf_test::PerfResultReporter SetUpSurfaceAggregatorReporter(
|
||||
const std::string& story) {
|
||||
perf_test::PerfResultReporter reporter(kMetricPrefixSurfaceAggregator, story);
|
||||
reporter.RegisterImportantMetric(kMetricSpeedRunsPerS, "runs/s");
|
||||
return reporter;
|
||||
}
|
||||
|
||||
class SurfaceAggregatorPerfTest : public testing::Test {
|
||||
public:
|
||||
SurfaceAggregatorPerfTest() : manager_(&shared_bitmap_manager_) {
|
||||
@ -42,7 +52,7 @@ class SurfaceAggregatorPerfTest : public testing::Test {
|
||||
float opacity,
|
||||
bool optimize_damage,
|
||||
bool full_damage,
|
||||
const std::string& name) {
|
||||
const std::string& story) {
|
||||
std::vector<std::unique_ptr<CompositorFrameSinkSupport>> child_supports(
|
||||
num_surfaces);
|
||||
std::vector<base::UnguessableToken> child_tokens(num_surfaces);
|
||||
@ -152,8 +162,8 @@ class SurfaceAggregatorPerfTest : public testing::Test {
|
||||
timer_.NextLap();
|
||||
} while (!timer_.HasTimeLimitExpired());
|
||||
|
||||
perf_test::PrintResult("aggregator_speed", "", name, timer_.LapsPerSecond(),
|
||||
"runs/s", true);
|
||||
auto reporter = SetUpSurfaceAggregatorReporter(story);
|
||||
reporter.AddResult(kMetricSpeedRunsPerS, timer_.LapsPerSecond());
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -170,19 +180,19 @@ TEST_F(SurfaceAggregatorPerfTest, ManySurfacesOpaque) {
|
||||
}
|
||||
|
||||
TEST_F(SurfaceAggregatorPerfTest, ManySurfacesOpaque_100) {
|
||||
RunTest(100, 1, 1.f, true, false, "(100 Surfaces, 1 quad each)");
|
||||
RunTest(100, 1, 1.f, true, false, "100_surfaces_1_quad_each");
|
||||
}
|
||||
|
||||
TEST_F(SurfaceAggregatorPerfTest, ManySurfacesOpaque_300) {
|
||||
RunTest(300, 1, 1.f, true, false, "(300 Surfaces, 1 quad each)");
|
||||
RunTest(300, 1, 1.f, true, false, "300_surfaces_1_quad_each");
|
||||
}
|
||||
|
||||
TEST_F(SurfaceAggregatorPerfTest, ManySurfacesManyQuadsOpaque_100) {
|
||||
RunTest(100, 100, 1.f, true, false, "(100 Surfaces, 100 quads each)");
|
||||
RunTest(100, 100, 1.f, true, false, "100_surfaces_100_quads_each");
|
||||
}
|
||||
|
||||
TEST_F(SurfaceAggregatorPerfTest, ManySurfacesManyQuadsOpaque_300) {
|
||||
RunTest(300, 100, 1.f, true, false, "(300 Surfaces, 100 quads each)");
|
||||
RunTest(300, 100, 1.f, true, false, "300_surfaces_100_quads_each");
|
||||
}
|
||||
|
||||
TEST_F(SurfaceAggregatorPerfTest, ManySurfacesTransparent) {
|
||||
|
@ -60,6 +60,7 @@ GTEST_CONVERSION_WHITELIST = [
|
||||
'load_library_perf_tests',
|
||||
'media_perftests',
|
||||
'views_perftests',
|
||||
'viz_perftests',
|
||||
'xr.vr.common_perftests',
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user