Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: cc/output/bsp_tree_perftest.cc

Issue 2320883002: Move BSP tree perf test to cc/output/. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/BUILD.gn ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/bsp_tree_perftest.cc
diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/output/bsp_tree_perftest.cc
similarity index 72%
copy from cc/trees/layer_tree_host_common_perftest.cc
copy to cc/output/bsp_tree_perftest.cc
index 768b4a155e40f29ed68492336c87ca04d9196962..7d2e4b6fafc621895479383d88da318efff0385e 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/output/bsp_tree_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,20 +35,13 @@ static const int kTimeLimitMillis = 2000;
static const int kWarmupRuns = 5;
static const int kTimeCheckInterval = 10;
-class LayerTreeHostCommonPerfTest : public LayerTreeTest {
+class BspTreePerfTest : public LayerTreeTest {
public:
- LayerTreeHostCommonPerfTest()
+ BspTreePerfTest()
: timer_(kWarmupRuns,
base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
kTimeCheckInterval) {}
- void ReadTestFile(const std::string& name) {
- base::FilePath test_data_dir;
- ASSERT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir));
- base::FilePath json_file = test_data_dir.AppendASCII(name + ".json");
- ASSERT_TRUE(base::ReadFileToString(json_file, &json_));
- }
-
void SetupTree() override {
gfx::Size viewport = gfx::Size(720, 1038);
layer_tree()->SetViewportSize(viewport);
@@ -61,79 +54,17 @@ class LayerTreeHostCommonPerfTest : public LayerTreeTest {
void SetTestName(const std::string& name) { test_name_ = name; }
- void AfterTest() override {
- CHECK(!test_name_.empty()) << "Must SetTestName() before TearDown().";
- perf_test::PrintResult("calc_draw_props_time",
- "",
- test_name_,
- 1000 * timer_.MsPerLap(),
- "us",
- true);
- }
-
- protected:
- FakeContentLayerClient content_layer_client_;
- LapTimer timer_;
- std::string test_name_;
- std::string json_;
-};
-
-class CalcDrawPropsTest : public LayerTreeHostCommonPerfTest {
- public:
- void RunCalcDrawProps() { RunTest(CompositorMode::SINGLE_THREADED); }
-
- void BeginTest() override { PostSetNeedsCommitToMainThread(); }
-
- void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
- timer_.Reset();
- LayerTreeImpl* active_tree = host_impl->active_tree();
-
- do {
- bool can_render_to_separate_surface = true;
- int max_texture_size = 8096;
- DoCalcDrawPropertiesImpl(can_render_to_separate_surface,
- max_texture_size,
- active_tree,
- host_impl);
-
- timer_.NextLap();
- } while (!timer_.HasTimeLimitExpired());
-
- EndTest();
- }
-
- void DoCalcDrawPropertiesImpl(bool can_render_to_separate_surface,
- int max_texture_size,
- LayerTreeImpl* active_tree,
- LayerTreeHostImpl* host_impl) {
- LayerImplList update_list;
- LayerTreeHostCommon::CalcDrawPropsImplInputs inputs(
- active_tree->root_layer_for_testing(), active_tree->DrawViewportSize(),
- host_impl->DrawTransform(), active_tree->device_scale_factor(),
- active_tree->current_page_scale_factor(),
- active_tree->InnerViewportContainerLayer(),
- active_tree->InnerViewportScrollLayer(),
- active_tree->OuterViewportScrollLayer(),
- active_tree->elastic_overscroll()->Current(active_tree->IsActiveTree()),
- active_tree->OverscrollElasticityLayer(), max_texture_size,
- can_render_to_separate_surface,
- host_impl->settings().layer_transforms_should_scale_layer_contents,
- false, // do not verify_clip_tree_calculation for perf tests
- false, // do not verify_transform_tree_calculation for perf tests
- &update_list, active_tree->property_trees());
- LayerTreeHostCommon::CalculateDrawProperties(&inputs);
- }
-};
-
-class BspTreePerfTest : public CalcDrawPropsTest {
- public:
- BspTreePerfTest() : num_duplicates_(1) {}
- void RunSortLayers() { RunTest(CompositorMode::SINGLE_THREADED); }
-
void SetNumberOfDuplicates(int num_duplicates) {
num_duplicates_ = num_duplicates;
}
+ void ReadTestFile(const std::string& name) {
+ base::FilePath test_data_dir;
+ ASSERT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir));
+ base::FilePath json_file = test_data_dir.AppendASCII(name + ".json");
+ ASSERT_TRUE(base::ReadFileToString(json_file, &json_));
+ }
+
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
@@ -142,10 +73,8 @@ class BspTreePerfTest : public CalcDrawPropsTest {
// itself
bool can_render_to_separate_surface = true;
int max_texture_size = 8096;
- DoCalcDrawPropertiesImpl(can_render_to_separate_surface,
- max_texture_size,
- active_tree,
- host_impl);
+ DoCalcDrawPropertiesImpl(can_render_to_separate_surface, max_texture_size,
+ active_tree, host_impl);
LayerImplList base_list;
BuildLayerImplList(active_tree->root_layer_for_testing(), &base_list);
@@ -175,6 +104,28 @@ class BspTreePerfTest : public CalcDrawPropsTest {
EndTest();
}
+ void DoCalcDrawPropertiesImpl(bool can_render_to_separate_surface,
+ int max_texture_size,
+ LayerTreeImpl* active_tree,
+ LayerTreeHostImpl* host_impl) {
+ LayerImplList update_list;
+ LayerTreeHostCommon::CalcDrawPropsImplInputs inputs(
+ active_tree->root_layer_for_testing(), active_tree->DrawViewportSize(),
+ host_impl->DrawTransform(), active_tree->device_scale_factor(),
+ active_tree->current_page_scale_factor(),
+ active_tree->InnerViewportContainerLayer(),
+ active_tree->InnerViewportScrollLayer(),
+ active_tree->OuterViewportScrollLayer(),
+ active_tree->elastic_overscroll()->Current(active_tree->IsActiveTree()),
+ active_tree->OverscrollElasticityLayer(), max_texture_size,
+ can_render_to_separate_surface,
+ host_impl->settings().layer_transforms_should_scale_layer_contents,
+ false, // do not verify_clip_tree_calculation for perf tests
+ false, // do not verify_transform_tree_calculation for perf tests
+ &update_list, active_tree->property_trees());
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+ }
+
void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) {
for (auto* layer_impl : *layer->layer_tree_impl()) {
if (layer_impl->Is3dSorted() && !layer_impl->bounds().IsEmpty()) {
@@ -183,73 +134,59 @@ class BspTreePerfTest : public CalcDrawPropsTest {
}
}
+ void AfterTest() override {
+ CHECK(!test_name_.empty()) << "Must SetTestName() before TearDown().";
+ perf_test::PrintResult("calc_draw_props_time", "", test_name_,
+ 1000 * timer_.MsPerLap(), "us", true);
+ }
+
private:
+ FakeContentLayerClient content_layer_client_;
+ LapTimer timer_;
+ std::string test_name_;
+ std::string json_;
LayerImplList base_list_;
- int num_duplicates_;
+ int num_duplicates_ = 1;
};
-TEST_F(CalcDrawPropsTest, TenTen) {
- SetTestName("10_10");
- ReadTestFile("10_10_layer_tree");
- RunCalcDrawProps();
-}
-
-TEST_F(CalcDrawPropsTest, HeavyPage) {
- SetTestName("heavy_page");
- ReadTestFile("heavy_layer_tree");
- RunCalcDrawProps();
-}
-
-TEST_F(CalcDrawPropsTest, TouchRegionLight) {
- SetTestName("touch_region_light");
- ReadTestFile("touch_region_light");
- RunCalcDrawProps();
-}
-
-TEST_F(CalcDrawPropsTest, TouchRegionHeavy) {
- SetTestName("touch_region_heavy");
- ReadTestFile("touch_region_heavy");
- RunCalcDrawProps();
-}
-
TEST_F(BspTreePerfTest, LayerSorterCubes) {
SetTestName("layer_sort_cubes");
ReadTestFile("layer_sort_cubes");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
TEST_F(BspTreePerfTest, LayerSorterRubik) {
SetTestName("layer_sort_rubik");
ReadTestFile("layer_sort_rubik");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
TEST_F(BspTreePerfTest, BspTreeCubes) {
SetTestName("bsp_tree_cubes");
SetNumberOfDuplicates(1);
ReadTestFile("layer_sort_cubes");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
TEST_F(BspTreePerfTest, BspTreeRubik) {
SetTestName("bsp_tree_rubik");
SetNumberOfDuplicates(1);
ReadTestFile("layer_sort_rubik");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
TEST_F(BspTreePerfTest, BspTreeCubes_2) {
SetTestName("bsp_tree_cubes_2");
SetNumberOfDuplicates(2);
ReadTestFile("layer_sort_cubes");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
TEST_F(BspTreePerfTest, BspTreeCubes_4) {
SetTestName("bsp_tree_cubes_4");
SetNumberOfDuplicates(4);
ReadTestFile("layer_sort_cubes");
- RunSortLayers();
+ RunTest(CompositorMode::SINGLE_THREADED);
}
} // namespace
« no previous file with comments | « cc/BUILD.gn ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698