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

Unified Diff: chrome/test/perf/frame_rate/frame_rate_tests.cc

Issue 7982007: add "did it run on GPU" check to frame_rate_tests.cc using AutomationProxy tracing feature (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 1 month 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 | « no previous file | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/perf/frame_rate/frame_rate_tests.cc
diff --git a/chrome/test/perf/frame_rate/frame_rate_tests.cc b/chrome/test/perf/frame_rate/frame_rate_tests.cc
index 41f8bd84ebf875b84b80af89b7887e4488a67a47..227206e548966b4ed7e4fdc817b15c206273ea7a 100644
--- a/chrome/test/perf/frame_rate/frame_rate_tests.cc
+++ b/chrome/test/perf/frame_rate/frame_rate_tests.cc
@@ -9,13 +9,16 @@
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/test/test_timeouts.h"
+#include "base/test/trace_event_analyzer.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/javascript_test_util.h"
#include "chrome/test/ui/ui_perf_test.h"
#include "net/base/net_util.h"
+#include "ui/gfx/gl/gl_implementation.h"
#include "ui/gfx/gl/gl_switches.h"
namespace {
@@ -30,7 +33,7 @@ enum FrameRateTestFlags {
kHasRedirect = 1 << 6, // Test page contains an HTML redirect
};
-std::string GetSuffixForTestFlags(int flags) {
+std::string GetSuffixForTestFlags(int flags, bool did_run_on_gpu) {
std::string suffix;
if (flags & kMakeBodyComposited)
suffix += "_comp";
@@ -40,6 +43,8 @@ std::string GetSuffixForTestFlags(int flags) {
suffix += "_nogpu";
nduca 2011/11/08 00:27:42 does the _nogpu get affected? Can we reconcile the
jbates 2011/11/09 02:14:46 Done.
if (flags & kUseReferenceBuild)
suffix += "_ref";
+ if (did_run_on_gpu)
+ suffix += "_gpu";
return suffix;
}
@@ -52,6 +57,10 @@ class FrameRateTest
dom_automation_enabled_ = true;
}
+ virtual bool IsReferenceBuild() const {
+ return (GetParam() & kUseReferenceBuild);
+ }
+
virtual FilePath GetDataPath(const std::string& name) {
// Make sure the test data is checked out.
FilePath test_path;
@@ -68,7 +77,7 @@ class FrameRateTest
}
virtual void SetUp() {
- if (GetParam() & kUseReferenceBuild) {
+ if (IsReferenceBuild()) {
UseReferenceBuild();
}
@@ -101,6 +110,30 @@ class FrameRateTest
UIPerfTest::SetUp();
}
+ bool DidRunOnGpu(const std::string& json_events) {
+ using namespace trace_analyzer;
+
+ // TODO(jbates): remove this check when ref builds are updated.
+ if (IsReferenceBuild())
+ return false;
+
+ // Check trace for GPU accleration.
+ scoped_ptr<TraceAnalyzer> analyzer(TraceAnalyzer::Create(json_events));
+ // Verify that sanity-check DoDeferredUpdate event exists.
+ EXPECT_TRUE(analyzer->FindOneEvent(Query(EVENT_NAME) ==
+ Query::String("DoDeferredUpdate")));
+
+ gfx::GLImplementation gl_impl = gfx::kGLImplementationNone;
+ const TraceEvent* gpu_event = analyzer->FindOneEvent(
+ Query(EVENT_NAME) == Query::String("SwapBuffers") &&
+ Query(EVENT_HAS_NUMBER_ARG, "GLImpl"));
+ if (gpu_event)
+ gl_impl = static_cast<gfx::GLImplementation>(
+ gpu_event->GetKnownArgAsInt("GLImpl"));
+ return (gl_impl == gfx::kGLImplementationDesktopGL ||
+ gl_impl == gfx::kGLImplementationEGLGLES2);
+ }
+
void RunTest(const std::string& name) {
if ((GetParam() & kRequiresGpu) &&
!CommandLine::ForCurrentProcess()->HasSwitch("enable-gpu")) {
@@ -146,6 +179,10 @@ class FrameRateTest
GURL("javascript:__make_body_composited();")));
}
+ // TODO(jbates): remove this check when ref builds are updated.
+ if (!IsReferenceBuild())
+ ASSERT_TRUE(automation()->BeginTracing("test_frame_rate_tests"));
+
// Start the tests.
ASSERT_TRUE(tab->NavigateToURLAsync(GURL("javascript:__start_all();")));
@@ -154,6 +191,11 @@ class FrameRateTest
tab, L"", L"window.domAutomationController.send(!__running_all);",
TestTimeouts::large_test_timeout_ms()));
+ // TODO(jbates): remove this check when ref builds are updated.
+ std::string json_events;
+ if (!IsReferenceBuild())
+ ASSERT_TRUE(automation()->EndTracing(&json_events));
+
// Read out the results.
std::wstring json;
ASSERT_TRUE(tab->ExecuteAndExtractString(
@@ -172,7 +214,7 @@ class FrameRateTest
ASSERT_TRUE(results.find("sigmas") != results.end());
std::string trace_name = "fps";
- trace_name += GetSuffixForTestFlags(GetParam());
+ trace_name += GetSuffixForTestFlags(GetParam(), DidRunOnGpu(json_events));
Justin Novosad 2011/11/08 14:58:43 Currently, the set of tests that run on the gpu ar
jbates 2011/11/09 02:14:46 Done as discussed.
printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(),
trace_name.c_str(),
results["gestures"].c_str(),
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698