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

Side by Side Diff: chrome/test/perf/rendering/throughput_tests.cc

Issue 10823007: Add threaded-compositor test mode to throughput_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 enum RunTestFlags { 48 enum RunTestFlags {
49 kNone = 0, 49 kNone = 0,
50 kInternal = 1 << 0, // Test uses internal test data. 50 kInternal = 1 << 0, // Test uses internal test data.
51 kAllowExternalDNS = 1 << 1, // Test needs external DNS lookup. 51 kAllowExternalDNS = 1 << 1, // Test needs external DNS lookup.
52 kIsGpuCanvasTest = 1 << 2 // Test uses GPU accelerated canvas features. 52 kIsGpuCanvasTest = 1 << 2 // Test uses GPU accelerated canvas features.
53 }; 53 };
54 54
55 enum ThroughputTestFlags { 55 enum ThroughputTestFlags {
56 kSW = 0, 56 kSW = 0,
57 kGPU = 1 << 0 57 kGPU = 1 << 0,
58 kCompositorThread = 1 << 1
58 }; 59 };
59 60
60 const int kSpinUpTimeMs = 4 * 1000; 61 const int kSpinUpTimeMs = 4 * 1000;
61 const int kRunTimeMs = 10 * 1000; 62 const int kRunTimeMs = 10 * 1000;
62 const int kIgnoreSomeFrames = 3; 63 const int kIgnoreSomeFrames = 3;
63 64
64 class ThroughputTest : public BrowserPerfTest { 65 class ThroughputTest : public BrowserPerfTest {
65 public: 66 public:
66 explicit ThroughputTest(ThroughputTestFlags flags) : 67 explicit ThroughputTest(int flags) :
67 use_gpu_(flags & kGPU), 68 use_gpu_(flags & kGPU),
69 use_compositor_thread_(flags & kCompositorThread),
68 spinup_time_ms_(kSpinUpTimeMs), 70 spinup_time_ms_(kSpinUpTimeMs),
69 run_time_ms_(kRunTimeMs) {} 71 run_time_ms_(kRunTimeMs) {}
70 72
71 // This indicates running on GPU bots, not necessarily using the GPU. 73 // This indicates running on GPU bots, not necessarily using the GPU.
72 bool IsGpuAvailable() const { 74 bool IsGpuAvailable() const {
73 return CommandLine::ForCurrentProcess()->HasSwitch("enable-gpu"); 75 return CommandLine::ForCurrentProcess()->HasSwitch("enable-gpu");
74 } 76 }
75 77
76 // Parse flags from JSON to control the test behavior. 78 // Parse flags from JSON to control the test behavior.
77 bool ParseFlagsFromJSON(const FilePath& json_dir, 79 bool ParseFlagsFromJSON(const FilePath& json_dir,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 command_line->AppendSwitch(switches::kDisableGpuVsync); 190 command_line->AppendSwitch(switches::kDisableGpuVsync);
189 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); 191 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
190 // Enable or disable GPU acceleration. 192 // Enable or disable GPU acceleration.
191 if (use_gpu_) { 193 if (use_gpu_) {
192 command_line->AppendSwitch(switches::kForceCompositingMode); 194 command_line->AppendSwitch(switches::kForceCompositingMode);
193 } else { 195 } else {
194 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); 196 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
195 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); 197 command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
196 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 198 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
197 } 199 }
200 if (use_compositor_thread_) {
201 ASSERT_TRUE(use_gpu_);
202 command_line->AppendSwitch(switches::kEnableThreadedCompositing);
203 } else {
204 command_line->AppendSwitch(switches::kDisableThreadedCompositing);
205 }
198 } 206 }
199 207
200 void Wait(int ms) { 208 void Wait(int ms) {
201 base::RunLoop run_loop; 209 base::RunLoop run_loop;
202 MessageLoop::current()->PostDelayedTask( 210 MessageLoop::current()->PostDelayedTask(
203 FROM_HERE, run_loop.QuitClosure(), 211 FROM_HERE, run_loop.QuitClosure(),
204 base::TimeDelta::FromMilliseconds(ms)); 212 base::TimeDelta::FromMilliseconds(ms));
205 content::RunThisRunLoop(&run_loop); 213 content::RunThisRunLoop(&run_loop);
206 } 214 }
207 215
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Cull a few leading and trailing events as they might be unreliable. 369 // Cull a few leading and trailing events as they might be unreliable.
362 TraceEventVector rate_events(frames->begin() + kIgnoreSomeFrames, 370 TraceEventVector rate_events(frames->begin() + kIgnoreSomeFrames,
363 frames->end() - kIgnoreSomeFrames); 371 frames->end() - kIgnoreSomeFrames);
364 trace_analyzer::RateStats stats; 372 trace_analyzer::RateStats stats;
365 ASSERT_TRUE(GetRateStats(rate_events, &stats, NULL)); 373 ASSERT_TRUE(GetRateStats(rate_events, &stats, NULL));
366 LOG(INFO) << "FPS = " << 1000000.0 / stats.mean_us; 374 LOG(INFO) << "FPS = " << 1000000.0 / stats.mean_us;
367 375
368 // Print perf results. 376 // Print perf results.
369 double mean_ms = stats.mean_us / 1000.0; 377 double mean_ms = stats.mean_us / 1000.0;
370 double std_dev_ms = stats.standard_deviation_us / 1000.0 / 1000.0; 378 double std_dev_ms = stats.standard_deviation_us / 1000.0 / 1000.0;
371 std::string trace_name = ran_on_gpu ? "gpu" : "software"; 379 std::string trace_name = use_compositor_thread_? "gpu_thread" :
380 ran_on_gpu ? "gpu" : "software";
372 std::string mean_and_error = base::StringPrintf("%f,%f", mean_ms, 381 std::string mean_and_error = base::StringPrintf("%f,%f", mean_ms,
373 std_dev_ms); 382 std_dev_ms);
374 perf_test::PrintResultMeanAndError(test_name, "", trace_name, 383 perf_test::PrintResultMeanAndError(test_name, "", trace_name,
375 mean_and_error, "frame_time", true); 384 mean_and_error, "frame_time", true);
376 385
377 if (flags & kAllowExternalDNS) 386 if (flags & kAllowExternalDNS)
378 ResetAllowExternalDNS(); 387 ResetAllowExternalDNS();
379 388
380 // Close the tab so that we can quit without timing out during the 389 // Close the tab so that we can quit without timing out during the
381 // wait-for-idle stage in browser_test framework. 390 // wait-for-idle stage in browser_test framework.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 private: 428 private:
420 int x_; 429 int x_;
421 int y_; 430 int y_;
422 int r_; 431 int r_;
423 int g_; 432 int g_;
424 int b_; 433 int b_;
425 Operator op_; 434 Operator op_;
426 }; 435 };
427 436
428 bool use_gpu_; 437 bool use_gpu_;
438 bool use_compositor_thread_;
429 int spinup_time_ms_; 439 int spinup_time_ms_;
430 int run_time_ms_; 440 int run_time_ms_;
431 FilePath local_cache_path_; 441 FilePath local_cache_path_;
432 GURL gurl_; 442 GURL gurl_;
433 scoped_ptr<net::ScopedDefaultHostResolverProc> host_resolver_override_; 443 scoped_ptr<net::ScopedDefaultHostResolverProc> host_resolver_override_;
434 scoped_ptr<WaitPixel> wait_for_pixel_; 444 scoped_ptr<WaitPixel> wait_for_pixel_;
435 }; 445 };
436 446
437 // For running tests on GPU: 447 // For running tests on GPU:
438 class ThroughputTestGPU : public ThroughputTest { 448 class ThroughputTestGPU : public ThroughputTest {
439 public: 449 public:
440 ThroughputTestGPU() : ThroughputTest(kGPU) {} 450 ThroughputTestGPU() : ThroughputTest(kGPU) {}
441 }; 451 };
442 452
453 // For running tests on GPU with the compositor thread:
454 class ThroughputTestThread : public ThroughputTest {
455 public:
456 ThroughputTestThread() : ThroughputTest(kGPU | kCompositorThread) {}
457 };
458
443 // For running tests on Software: 459 // For running tests on Software:
444 class ThroughputTestSW : public ThroughputTest { 460 class ThroughputTestSW : public ThroughputTest {
445 public: 461 public:
446 ThroughputTestSW() : ThroughputTest(kSW) {} 462 ThroughputTestSW() : ThroughputTest(kSW) {}
447 }; 463 };
448 464
449 //////////////////////////////////////////////////////////////////////////////// 465 ////////////////////////////////////////////////////////////////////////////////
450 /// Tests 466 /// Tests
451 467
452 // Run this test with a URL on the command line: 468 // Run this test with a URL on the command line:
(...skipping 19 matching lines...) Expand all
472 } 488 }
473 489
474 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_TestURL) { 490 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_TestURL) {
475 RunTestWithURL(kAllowExternalDNS); 491 RunTestWithURL(kAllowExternalDNS);
476 } 492 }
477 493
478 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, Particles) { 494 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, Particles) {
479 RunTest("particles", kInternal); 495 RunTest("particles", kInternal);
480 } 496 }
481 497
498 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, Particles) {
499 RunTest("particles", kInternal);
500 }
501
482 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasDemoSW) { 502 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasDemoSW) {
483 RunTest("canvas-demo", kInternal); 503 RunTest("canvas-demo", kInternal);
484 } 504 }
485 505
486 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasDemoGPU) { 506 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasDemoGPU) {
487 RunTest("canvas-demo", kInternal | kIsGpuCanvasTest); 507 RunTest("canvas-demo", kInternal | kIsGpuCanvasTest);
488 } 508 }
489 509
510 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasDemoGPU) {
511 RunTest("canvas-demo", kInternal | kIsGpuCanvasTest);
512 }
513
490 // CompositingHugeDivSW timed out on Mac Intel Release GPU bot 514 // CompositingHugeDivSW timed out on Mac Intel Release GPU bot
491 // See crbug.com/114781 515 // See crbug.com/114781
492 // Stopped producing results in SW: crbug.com/127621 516 // Stopped producing results in SW: crbug.com/127621
493 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DISABLED_CompositingHugeDivSW) { 517 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DISABLED_CompositingHugeDivSW) {
494 RunTest("compositing_huge_div", kNone); 518 RunTest("compositing_huge_div", kNone);
495 } 519 }
496 520
497 // Failing with insufficient frames: crbug.com/127595 521 // Failing with insufficient frames: crbug.com/127595
498 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_CompositingHugeDivGPU) { 522 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_CompositingHugeDivGPU) {
499 RunTest("compositing_huge_div", kNone); 523 RunTest("compositing_huge_div", kNone);
500 } 524 }
501 525
502 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DrawImageShadowSW) { 526 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DrawImageShadowSW) {
503 RunTest("canvas2d_balls_with_shadow", kNone); 527 RunTest("canvas2d_balls_with_shadow", kNone);
504 } 528 }
505 529
506 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DrawImageShadowGPU) { 530 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DrawImageShadowGPU) {
507 RunTest("canvas2d_balls_with_shadow", kNone | kIsGpuCanvasTest); 531 RunTest("canvas2d_balls_with_shadow", kNone | kIsGpuCanvasTest);
508 } 532 }
509 533
534 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, DrawImageShadowGPU) {
535 RunTest("canvas2d_balls_with_shadow", kNone | kIsGpuCanvasTest);
536 }
537
510 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasToCanvasDrawSW) { 538 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasToCanvasDrawSW) {
511 if (IsGpuAvailable() && 539 if (IsGpuAvailable() &&
512 GPUTestBotConfig::CurrentConfigMatches("MAC AMD")) 540 GPUTestBotConfig::CurrentConfigMatches("MAC AMD"))
513 return; 541 return;
514 RunTest("canvas2d_balls_draw_from_canvas", kNone); 542 RunTest("canvas2d_balls_draw_from_canvas", kNone);
515 } 543 }
516 544
517 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasToCanvasDrawGPU) { 545 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasToCanvasDrawGPU) {
518 if (IsGpuAvailable() && 546 if (IsGpuAvailable() &&
519 GPUTestBotConfig::CurrentConfigMatches("MAC AMD")) 547 GPUTestBotConfig::CurrentConfigMatches("MAC AMD"))
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 580 }
553 581
554 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { 582 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) {
555 RunCanvasBenchTest("many_images", kNone); 583 RunCanvasBenchTest("many_images", kNone);
556 } 584 }
557 585
558 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { 586 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) {
559 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 587 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
560 } 588 }
561 589
590 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasManyImagesGPU) {
591 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
592 }
593
562 } // namespace 594 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698