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

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

Issue 10911268: Add some TraceAnalyzer utility methods to simplify test code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/perf/rendering/latency_tests.cc ('k') | 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 LOG(INFO) << "Spinning up test..."; 334 LOG(INFO) << "Spinning up test...";
335 ASSERT_TRUE(tracing::BeginTracing("test_gpu")); 335 ASSERT_TRUE(tracing::BeginTracing("test_gpu"));
336 Wait(spinup_time_ms_); 336 Wait(spinup_time_ms_);
337 ASSERT_TRUE(tracing::EndTracing(&json_events)); 337 ASSERT_TRUE(tracing::EndTracing(&json_events));
338 338
339 // Wait for a pixel color to change (if requested). 339 // Wait for a pixel color to change (if requested).
340 WaitForPixelColor(); 340 WaitForPixelColor();
341 341
342 // Check if GPU is rendering: 342 // Check if GPU is rendering:
343 analyzer.reset(TraceAnalyzer::Create(json_events)); 343 analyzer.reset(TraceAnalyzer::Create(json_events));
344 bool ran_on_gpu = (analyzer->FindEvents(Query::EventName() == 344 bool ran_on_gpu = (analyzer->FindEvents(
345 Query::String("SwapBuffers"), &events_gpu) > 0u); 345 Query::EventNameIs("SwapBuffers"), &events_gpu) > 0u);
346 LOG(INFO) << "Mode: " << (ran_on_gpu ? "GPU" : "Software"); 346 LOG(INFO) << "Mode: " << (ran_on_gpu ? "GPU" : "Software");
347 EXPECT_EQ(use_gpu_, ran_on_gpu); 347 EXPECT_EQ(use_gpu_, ran_on_gpu);
348 348
349 // Let the test run for a while. 349 // Let the test run for a while.
350 LOG(INFO) << "Running test..."; 350 LOG(INFO) << "Running test...";
351 ASSERT_TRUE(tracing::BeginTracing("test_fps")); 351 ASSERT_TRUE(tracing::BeginTracing("test_fps"));
352 Wait(run_time_ms_); 352 Wait(run_time_ms_);
353 ASSERT_TRUE(tracing::EndTracing(&json_events)); 353 ASSERT_TRUE(tracing::EndTracing(&json_events));
354 354
355 // Search for frame ticks. We look for both SW and GPU frame ticks so that 355 // Search for frame ticks. We look for both SW and GPU frame ticks so that
356 // the test can verify that only one or the other are found. 356 // the test can verify that only one or the other are found.
357 analyzer.reset(TraceAnalyzer::Create(json_events)); 357 analyzer.reset(TraceAnalyzer::Create(json_events));
358 Query query_sw = Query::EventName() == Query::String("TestFrameTickSW"); 358 Query query_sw = Query::EventNameIs("TestFrameTickSW");
359 Query query_gpu = Query::EventName() == Query::String("TestFrameTickGPU"); 359 Query query_gpu = Query::EventNameIs("TestFrameTickGPU");
360 analyzer->FindEvents(query_sw, &events_sw); 360 analyzer->FindEvents(query_sw, &events_sw);
361 analyzer->FindEvents(query_gpu, &events_gpu); 361 analyzer->FindEvents(query_gpu, &events_gpu);
362 TraceEventVector* frames = NULL; 362 TraceEventVector* frames = NULL;
363 if (use_gpu_) { 363 if (use_gpu_) {
364 frames = &events_gpu; 364 frames = &events_gpu;
365 EXPECT_EQ(0u, events_sw.size()); 365 EXPECT_EQ(0u, events_sw.size());
366 } else { 366 } else {
367 frames = &events_sw; 367 frames = &events_sw;
368 EXPECT_EQ(0u, events_gpu.size()); 368 EXPECT_EQ(0u, events_gpu.size());
369 } 369 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { 588 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) {
589 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 589 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
590 } 590 }
591 591
592 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasManyImagesGPU) { 592 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasManyImagesGPU) {
593 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 593 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
594 } 594 }
595 595
596 } // namespace 596 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/perf/rendering/latency_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698