diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 02:16:16 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-04 02:16:16 +0000 |
commit | ab1555aafbd2a6a7a07fe262cdc0ac96f4688f13 (patch) | |
tree | 281c0422ddb8e1b5dc232a31bb76feb606b08d0f /cc | |
parent | 815d3e2f339169964a48e3b869bf76090a9a82dc (diff) | |
download | chromium_src-ab1555aafbd2a6a7a07fe262cdc0ac96f4688f13.zip chromium_src-ab1555aafbd2a6a7a07fe262cdc0ac96f4688f13.tar.gz chromium_src-ab1555aafbd2a6a7a07fe262cdc0ac96f4688f13.tar.bz2 |
[cc_perftests] Output results in a format the perf dashboard understands.
Previously, these were outputting:
*RESULT foo_bar: 123 ms
Now, they correctly output:
*RESULT foo: bar= 123 ms
BUG=
Review URL: https://chromiumcodereview.appspot.com/23707017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc_tests.gyp | 1 | ||||
-rw-r--r-- | cc/resources/picture_layer_tiling_perftest.cc | 46 | ||||
-rw-r--r-- | cc/resources/raster_worker_pool_perftest.cc | 34 | ||||
-rw-r--r-- | cc/resources/tile_manager_perftest.cc | 28 | ||||
-rw-r--r-- | cc/resources/worker_pool_perftest.cc | 35 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_perftest.cc | 30 |
6 files changed, 83 insertions, 91 deletions
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 114b4a9..784f45f 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -236,6 +236,7 @@ '../skia/skia.gyp:skia', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', + '../testing/perf/perf_test.gyp:*', '../ui/ui.gyp:ui', 'cc.gyp:cc', 'cc_test_support', diff --git a/cc/resources/picture_layer_tiling_perftest.cc b/cc/resources/picture_layer_tiling_perftest.cc index 22dab13..655603d 100644 --- a/cc/resources/picture_layer_tiling_perftest.cc +++ b/cc/resources/picture_layer_tiling_perftest.cc @@ -6,6 +6,7 @@ #include "cc/test/fake_picture_layer_tiling_client.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_test.h" namespace cc { @@ -34,12 +35,6 @@ class PictureLayerTilingPerfTest : public testing::Test { elapsed_ = base::TimeTicks::HighResNow() - start_time_; } - void AfterTest(const std::string& test_name) { - printf("*RESULT %s: %.2f runs/s\n", - test_name.c_str(), - num_runs_ / elapsed_.InSecondsF()); - } - bool DidRun() { ++num_runs_; if (num_runs_ == kWarmupRuns) @@ -62,7 +57,8 @@ class PictureLayerTilingPerfTest : public testing::Test { picture_layer_tiling_->Invalidate(region); } while (DidRun()); - AfterTest(test_name); + perf_test::PrintResult("invalidation", "", test_name, + num_runs_ / elapsed_.InSecondsF(), "runs/s", true); } void RunUpdateTilePrioritiesStationaryTest( @@ -88,7 +84,8 @@ class PictureLayerTilingPerfTest : public testing::Test { 250); } while (DidRun()); - AfterTest(test_name); + perf_test::PrintResult("update_tile_priorities_stationary", "", test_name, + num_runs_ / elapsed_.InSecondsF(), "runs/s", true); } void RunUpdateTilePrioritiesScrollingTest( @@ -132,7 +129,8 @@ class PictureLayerTilingPerfTest : public testing::Test { } } while (DidRun()); - AfterTest(test_name); + perf_test::PrintResult("update_tile_priorities_scrolling", "", test_name, + num_runs_ / elapsed_.InSecondsF(), "runs/s", true); } private: @@ -146,39 +144,27 @@ class PictureLayerTilingPerfTest : public testing::Test { TEST_F(PictureLayerTilingPerfTest, Invalidate) { Region one_tile(gfx::Rect(256, 256)); - RunInvalidateTest("invalidation_1x1", one_tile); + RunInvalidateTest("1x1", one_tile); Region half_region(gfx::Rect(25 * 256, 50 * 256)); - RunInvalidateTest("invalidation_25x50", half_region); + RunInvalidateTest("25x50", half_region); Region full_region(gfx::Rect(50 * 256, 50 * 256)); - RunInvalidateTest("invalidation_50x50", full_region); + RunInvalidateTest("50x50", full_region); } TEST_F(PictureLayerTilingPerfTest, UpdateTilePriorities) { gfx::Transform transform; - RunUpdateTilePrioritiesStationaryTest( - "update_tile_priorities_stationary_no_transform", - transform); - RunUpdateTilePrioritiesScrollingTest( - "update_tile_priorities_scrolling_no_transform", - transform); + RunUpdateTilePrioritiesStationaryTest("no_transform", transform); + RunUpdateTilePrioritiesScrollingTest("no_transform", transform); transform.Rotate(10); - RunUpdateTilePrioritiesStationaryTest( - "update_tile_priorities_stationary_rotation", - transform); - RunUpdateTilePrioritiesScrollingTest( - "update_tile_priorities_scrolling_rotation", - transform); + RunUpdateTilePrioritiesStationaryTest("rotation", transform); + RunUpdateTilePrioritiesScrollingTest("rotation", transform); transform.ApplyPerspectiveDepth(10); - RunUpdateTilePrioritiesStationaryTest( - "update_tile_priorities_stationary_perspective", - transform); - RunUpdateTilePrioritiesScrollingTest( - "update_tile_priorities_scrolling_perspective", - transform); + RunUpdateTilePrioritiesStationaryTest("perspective", transform); + RunUpdateTilePrioritiesScrollingTest("perspective", transform); } } // namespace diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc index 7cc5ee9..efda5ca 100644 --- a/cc/resources/raster_worker_pool_perftest.cc +++ b/cc/resources/raster_worker_pool_perftest.cc @@ -7,6 +7,7 @@ #include "base/time/time.h" #include "cc/test/lap_timer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_test.h" namespace cc { @@ -134,12 +135,6 @@ class RasterWorkerPoolPerfTest : public testing::Test { raster_worker_pool_->Shutdown(); } - void AfterTest(const std::string test_name) { - // Format matches chrome/test/perf/perf_test.h:PrintResult - printf( - "*RESULT %s: %.2f runs/s\n", test_name.c_str(), timer_.LapsPerSecond()); - } - void CreateTasks(RasterWorkerPool::RasterTask::Queue* tasks, unsigned num_raster_tasks, unsigned num_image_decode_tasks) { @@ -193,7 +188,8 @@ class RasterWorkerPoolPerfTest : public testing::Test { timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - AfterTest(test_name); + perf_test::PrintResult("build_task_graph", "", test_name, + timer_.LapsPerSecond(), "runs/s", true); } protected: @@ -206,18 +202,18 @@ class RasterWorkerPoolPerfTest : public testing::Test { }; TEST_F(RasterWorkerPoolPerfTest, BuildTaskGraph) { - RunBuildTaskGraphTest("build_task_graph_10_0", 10, 0); - RunBuildTaskGraphTest("build_task_graph_100_0", 100, 0); - RunBuildTaskGraphTest("build_task_graph_1000_0", 1000, 0); - RunBuildTaskGraphTest("build_task_graph_10_1", 10, 1); - RunBuildTaskGraphTest("build_task_graph_100_1", 100, 1); - RunBuildTaskGraphTest("build_task_graph_1000_1", 1000, 1); - RunBuildTaskGraphTest("build_task_graph_10_4", 10, 4); - RunBuildTaskGraphTest("build_task_graph_100_4", 100, 4); - RunBuildTaskGraphTest("build_task_graph_1000_4", 1000, 4); - RunBuildTaskGraphTest("build_task_graph_10_16", 10, 16); - RunBuildTaskGraphTest("build_task_graph_100_16", 100, 16); - RunBuildTaskGraphTest("build_task_graph_1000_16", 1000, 16); + RunBuildTaskGraphTest("10_0", 10, 0); + RunBuildTaskGraphTest("100_0", 100, 0); + RunBuildTaskGraphTest("1000_0", 1000, 0); + RunBuildTaskGraphTest("10_1", 10, 1); + RunBuildTaskGraphTest("100_1", 100, 1); + RunBuildTaskGraphTest("1000_1", 1000, 1); + RunBuildTaskGraphTest("10_4", 10, 4); + RunBuildTaskGraphTest("100_4", 100, 4); + RunBuildTaskGraphTest("1000_4", 1000, 4); + RunBuildTaskGraphTest("10_16", 10, 16); + RunBuildTaskGraphTest("100_16", 100, 16); + RunBuildTaskGraphTest("1000_16", 1000, 16); } } // namespace diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc index 28f3914..4965132 100644 --- a/cc/resources/tile_manager_perftest.cc +++ b/cc/resources/tile_manager_perftest.cc @@ -14,6 +14,7 @@ #include "cc/test/test_tile_priorities.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_test.h" namespace cc { @@ -58,12 +59,6 @@ class TileManagerPerfTest : public testing::Test { picture_pile_ = NULL; } - void AfterTest(const std::string test_name) { - // Format matches chrome/test/perf/perf_test.h:PrintResult - printf( - "*RESULT %s: %.2f runs/s\n", test_name.c_str(), timer_.LapsPerSecond()); - } - TilePriority GetTilePriorityFromBin(ManagedTileBin bin) { switch (bin) { case NOW_AND_READY_TO_DRAW_BIN: @@ -156,7 +151,8 @@ class TileManagerPerfTest : public testing::Test { timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - AfterTest(test_name); + perf_test::PrintResult("manage_tiles", "", test_name, + timer_.LapsPerSecond(), "runs/s", true); } private: @@ -171,15 +167,15 @@ class TileManagerPerfTest : public testing::Test { }; TEST_F(TileManagerPerfTest, ManageTiles) { - RunManageTilesTest("manage_tiles_100_0", 100, 0); - RunManageTilesTest("manage_tiles_1000_0", 1000, 0); - RunManageTilesTest("manage_tiles_10000_0", 10000, 0); - RunManageTilesTest("manage_tiles_100_10", 100, 10); - RunManageTilesTest("manage_tiles_1000_10", 1000, 10); - RunManageTilesTest("manage_tiles_10000_10", 10000, 10); - RunManageTilesTest("manage_tiles_100_100", 100, 100); - RunManageTilesTest("manage_tiles_1000_100", 1000, 100); - RunManageTilesTest("manage_tiles_10000_100", 10000, 100); + RunManageTilesTest("100_0", 100, 0); + RunManageTilesTest("1000_0", 1000, 0); + RunManageTilesTest("10000_0", 10000, 0); + RunManageTilesTest("100_10", 100, 10); + RunManageTilesTest("1000_10", 1000, 10); + RunManageTilesTest("10000_10", 10000, 10); + RunManageTilesTest("100_100", 100, 100); + RunManageTilesTest("1000_100", 1000, 100); + RunManageTilesTest("10000_100", 10000, 100); } } // namespace diff --git a/cc/resources/worker_pool_perftest.cc b/cc/resources/worker_pool_perftest.cc index 0618650..346b291 100644 --- a/cc/resources/worker_pool_perftest.cc +++ b/cc/resources/worker_pool_perftest.cc @@ -8,6 +8,7 @@ #include "cc/base/completion_event.h" #include "cc/test/lap_timer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/perf/perf_test.h" namespace cc { @@ -181,7 +182,8 @@ class WorkerPoolPerfTest : public testing::Test { timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - AfterTest(test_name); + perf_test::PrintResult("schedule_tasks", "", test_name, + timer_.LapsPerSecond(), "runs/s", true); } void RunExecuteTasksTest(const std::string test_name, @@ -199,7 +201,8 @@ class WorkerPoolPerfTest : public testing::Test { timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - AfterTest(test_name); + perf_test::PrintResult("execute_tasks", "", test_name, + timer_.LapsPerSecond(), "runs/s", true); } protected: @@ -208,23 +211,23 @@ class WorkerPoolPerfTest : public testing::Test { }; TEST_F(WorkerPoolPerfTest, ScheduleTasks) { - RunScheduleTasksTest("schedule_tasks_1_10", 1, 10); - RunScheduleTasksTest("schedule_tasks_1_1000", 1, 1000); - RunScheduleTasksTest("schedule_tasks_2_10", 2, 10); - RunScheduleTasksTest("schedule_tasks_5_5", 5, 5); - RunScheduleTasksTest("schedule_tasks_10_2", 10, 2); - RunScheduleTasksTest("schedule_tasks_1000_1", 1000, 1); - RunScheduleTasksTest("schedule_tasks_10_1", 10, 1); + RunScheduleTasksTest("1_10", 1, 10); + RunScheduleTasksTest("1_1000", 1, 1000); + RunScheduleTasksTest("2_10", 2, 10); + RunScheduleTasksTest("5_5", 5, 5); + RunScheduleTasksTest("10_2", 10, 2); + RunScheduleTasksTest("1000_1", 1000, 1); + RunScheduleTasksTest("10_1", 10, 1); } TEST_F(WorkerPoolPerfTest, ExecuteTasks) { - RunExecuteTasksTest("execute_tasks_1_10", 1, 10); - RunExecuteTasksTest("execute_tasks_1_1000", 1, 1000); - RunExecuteTasksTest("execute_tasks_2_10", 2, 10); - RunExecuteTasksTest("execute_tasks_5_5", 5, 5); - RunExecuteTasksTest("execute_tasks_10_2", 10, 2); - RunExecuteTasksTest("execute_tasks_1000_1", 1000, 1); - RunExecuteTasksTest("execute_tasks_10_1", 10, 1); + RunExecuteTasksTest("1_10", 1, 10); + RunExecuteTasksTest("1_1000", 1, 1000); + RunExecuteTasksTest("2_10", 2, 10); + RunExecuteTasksTest("5_5", 5, 5); + RunExecuteTasksTest("10_2", 10, 2); + RunExecuteTasksTest("1000_1", 1000, 1); + RunExecuteTasksTest("10_1", 10, 1); } } // namespace diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index ca7ffa08..b074d73 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc @@ -18,6 +18,7 @@ #include "cc/test/layer_tree_test.h" #include "cc/test/paths.h" #include "cc/trees/layer_tree_impl.h" +#include "testing/perf/perf_test.h" namespace cc { namespace { @@ -78,16 +79,16 @@ class LayerTreeHostPerfTest : public LayerTreeTest { virtual void BuildTree() {} virtual void AfterTest() OVERRIDE { - // Format matches chrome/test/perf/perf_test.h:PrintResult - printf("*RESULT %s: frames: %d, %.2f ms/frame\n", - test_name_.c_str(), - draw_timer_.NumLaps(), - draw_timer_.MsPerLap()); + CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest()."; + perf_test::PrintResult("layer_tree_host_frame_count", "", test_name_, + draw_timer_.NumLaps(), "count", true); + perf_test::PrintResult("layer_tree_host_frame_time", "", test_name_, + 1000 * draw_timer_.MsPerLap(), "us", true); if (measure_commit_cost_) { - printf("*RESULT %s: commits: %d, %.2f ms/commit\n", - test_name_.c_str(), - commit_timer_.NumLaps(), - commit_timer_.MsPerLap()); + perf_test::PrintResult("layer_tree_host_commit_count", "", test_name_, + commit_timer_.NumLaps(), "count", true); + perf_test::PrintResult("layer_tree_host_commit_time", "", test_name_, + 1000 * commit_timer_.MsPerLap(), "us", true); } } @@ -110,8 +111,11 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { : LayerTreeHostPerfTest() { } - void ReadTestFile(std::string name) { + void SetTestName(const std::string& name) { test_name_ = name; + } + + void ReadTestFile(const std::string& name) { base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); base::FilePath json_file = test_data_dir.AppendASCII(name + ".json"); @@ -133,6 +137,7 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { // Simulates a tab switcher scene with two stacks of 10 tabs each. TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { + SetTestName("10_10_single_thread"); ReadTestFile("10_10_layer_tree"); RunTest(false, false, false); } @@ -141,6 +146,7 @@ TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread) { TEST_F(LayerTreeHostPerfTestJsonReader, TenTenSingleThread_FullDamageEachFrame) { full_damage_each_frame_ = true; + SetTestName("10_10_single_thread_full_damage_each_frame"); ReadTestFile("10_10_layer_tree"); RunTest(false, false, false); } @@ -174,6 +180,7 @@ class LayerTreeHostPerfTestLeafInvalidates // Simulates a tab switcher scene with two stacks of 10 tabs each. Invalidate a // property on a leaf layer in the tree every commit. TEST_F(LayerTreeHostPerfTestLeafInvalidates, TenTenSingleThread) { + SetTestName("10_10_single_thread_leaf_invalidates"); ReadTestFile("10_10_layer_tree"); RunTest(false, false, false); } @@ -201,6 +208,7 @@ class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { }; TEST_F(ScrollingLayerTreePerfTest, LongScrollablePage) { + SetTestName("long_scrollable_page"); ReadTestFile("long_scrollable_page"); RunTest(false, false, false); } @@ -215,6 +223,7 @@ class ImplSidePaintingPerfTest : public LayerTreeHostPerfTestJsonReader { TEST_F(ImplSidePaintingPerfTest, HeavyPage) { animation_driven_drawing_ = true; measure_commit_cost_ = true; + SetTestName("heavy_page"); ReadTestFile("heavy_layer_tree"); RunTestWithImplSidePainting(); } @@ -278,6 +287,7 @@ class PageScaleImplSidePaintingPerfTest : public ImplSidePaintingPerfTest { TEST_F(PageScaleImplSidePaintingPerfTest, HeavyPage) { measure_commit_cost_ = true; + SetTestName("heavy_page_page_scale"); ReadTestFile("heavy_layer_tree"); RunTestWithImplSidePainting(); } |