Commit c50f5266 authored by dmurph@chromium.org's avatar dmurph@chromium.org

Removed benchmark results object from rendering benchmarks, now one result per benchmark


Review URL: https://chromiumcodereview.appspot.com/10827421

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152426 0039d316-1c4b-4281-b951-d872f2087c98
parent 719aeb23
...@@ -245,7 +245,6 @@ ...@@ -245,7 +245,6 @@
'renderer/renderer_webkitplatformsupport_impl.h', 'renderer/renderer_webkitplatformsupport_impl.h',
'renderer/rendering_benchmark.cc', 'renderer/rendering_benchmark.cc',
'renderer/rendering_benchmark.h', 'renderer/rendering_benchmark.h',
'renderer/rendering_benchmark_results.h',
'renderer/speech_recognition_dispatcher.cc', 'renderer/speech_recognition_dispatcher.cc',
'renderer/speech_recognition_dispatcher.h', 'renderer/speech_recognition_dispatcher.h',
'renderer/text_input_client_observer.cc', 'renderer/text_input_client_observer.cc',
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/time.h" #include "base/time.h"
#include "content/renderer/rendering_benchmark.h" #include "content/renderer/rendering_benchmark.h"
#include "content/renderer/rendering_benchmark_results.h"
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/utils/SkNullCanvas.h" #include "third_party/skia/include/utils/SkNullCanvas.h"
...@@ -54,14 +53,10 @@ class CustomPaintBenchmark ...@@ -54,14 +53,10 @@ class CustomPaintBenchmark
delete canvas; delete canvas;
} }
virtual void Run(content::RenderingBenchmarkResults* results, virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
WebViewBenchmarkSupport* support) OVERRIDE {
paint_time_total_ = TimeDelta(); paint_time_total_ = TimeDelta();
support->paint(this, paint_mode_); support->paint(this, paint_mode_);
results->AddResult(name(), return paint_time_total_.InMillisecondsF();
"paintTime",
"s",
paint_time_total_.InSecondsF());
} }
private: private:
...@@ -84,30 +79,45 @@ class BitmapCanvasPaintBenchmark : public CustomPaintBenchmark { ...@@ -84,30 +79,45 @@ class BitmapCanvasPaintBenchmark : public CustomPaintBenchmark {
} }
}; };
class NullCanvasPaintBenchmark : public CustomPaintBenchmark { class CanvasCountBenchmark
: public content::RenderingBenchmark,
public WebViewBenchmarkSupport::PaintClient {
public: public:
NullCanvasPaintBenchmark(const std::string& name, CanvasCountBenchmark(const std::string& name,
WebViewBenchmarkSupport::PaintMode paint_mode) WebViewBenchmarkSupport::PaintMode paint_mode)
: CustomPaintBenchmark(name, paint_mode), : content::RenderingBenchmark(name),
canvas_count_(0) { } canvas_count_(0),
paint_mode_(paint_mode) { }
virtual WebCanvas* willPaint(const WebSize& size) OVERRIDE {
++canvas_count_;
return SkCreateNullCanvas();
}
virtual void didPaint(WebCanvas* canvas) OVERRIDE {
delete canvas;
}
virtual void Run(content::RenderingBenchmarkResults* results, virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
WebViewBenchmarkSupport* support) OVERRIDE {
canvas_count_ = 0; canvas_count_ = 0;
CustomPaintBenchmark::Run(results, support); support->paint(this, paint_mode_);
results->AddResult(name(), return canvas_count_;
"canvasCount",
"i",
canvas_count_);
} }
private:
int canvas_count_;
const WebViewBenchmarkSupport::PaintMode paint_mode_;
};
class NullCanvasPaintBenchmark : public CustomPaintBenchmark {
public:
NullCanvasPaintBenchmark(const std::string& name,
WebViewBenchmarkSupport::PaintMode paint_mode)
: CustomPaintBenchmark(name, paint_mode) { }
private: private:
virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE { virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE {
++canvas_count_;
return SkCreateNullCanvas(); return SkCreateNullCanvas();
} }
int canvas_count_;
}; };
class SkPicturePaintBenchmark : public CustomPaintBenchmark { class SkPicturePaintBenchmark : public CustomPaintBenchmark {
...@@ -163,14 +173,10 @@ class TiledReplayBenchmark ...@@ -163,14 +173,10 @@ class TiledReplayBenchmark
} }
} }
virtual void Run(content::RenderingBenchmarkResults* results, virtual double Run(WebViewBenchmarkSupport* support) {
WebViewBenchmarkSupport* support) {
paint_time_total_ = TimeDelta(); paint_time_total_ = TimeDelta();
support->paint(this, paint_mode_); support->paint(this, paint_mode_);
results->AddResult(name(), return paint_time_total_.InMillisecondsF();
"repaintTime",
"s",
paint_time_total_.InSecondsF());
} }
private: private:
...@@ -239,40 +245,43 @@ namespace content { ...@@ -239,40 +245,43 @@ namespace content {
ScopedVector<RenderingBenchmark> AllRenderingBenchmarks() { ScopedVector<RenderingBenchmark> AllRenderingBenchmarks() {
ScopedVector<RenderingBenchmark> benchmarks; ScopedVector<RenderingBenchmark> benchmarks;
benchmarks.push_back(new BitmapCanvasPaintBenchmark( benchmarks.push_back(new BitmapCanvasPaintBenchmark(
"PaintEverythingToBitmap", "PaintEverythingToBitmapMs",
WebViewBenchmarkSupport::PaintModeEverything)); WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new NullCanvasPaintBenchmark( benchmarks.push_back(new NullCanvasPaintBenchmark(
"PaintEverythingToNullCanvas", "PaintEverythingToNullCanvasMs",
WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new CanvasCountBenchmark(
"LayerCount",
WebViewBenchmarkSupport::PaintModeEverything)); WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new SkPicturePaintBenchmark( benchmarks.push_back(new SkPicturePaintBenchmark(
"PaintEverythingToSkPicture", "PaintEverythingToSkPictureMs",
WebViewBenchmarkSupport::PaintModeEverything)); WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new SquareTiledReplayBenchmark( benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo256x256Bitmap", "RepaintEverythingTo256x256BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
256)); 256));
benchmarks.push_back(new SquareTiledReplayBenchmark( benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo128x128Bitmap", "RepaintEverythingTo128x128BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
128)); 128));
benchmarks.push_back(new SquareTiledReplayBenchmark( benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo512x512Bitmap", "RepaintEverythingTo512x512BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
512)); 512));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark( benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx256Bitmap", "RepaintEverythingToLayerWidthx256BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
256)); 256));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark( benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx128Bitmap", "RepaintEverythingToLayerWidthx128BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
128)); 128));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark( benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx64Bitmap", "RepaintEverythingToLayerWidthx64BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
64)); 64));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark( benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx512Bitmap", "RepaintEverythingToLayerWidthx512BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything, WebViewBenchmarkSupport::PaintModeEverything,
512)); 512));
return benchmarks.Pass(); return benchmarks.Pass();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "content/renderer/all_rendering_benchmarks.h" #include "content/renderer/all_rendering_benchmarks.h"
#include "content/renderer/render_view_impl.h" #include "content/renderer/render_view_impl.h"
#include "content/renderer/rendering_benchmark.h" #include "content/renderer/rendering_benchmark.h"
#include "content/renderer/rendering_benchmark_results.h"
#include "third_party/skia/include/core/SkGraphics.h" #include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkStream.h"
...@@ -85,37 +84,6 @@ class SkPictureRecorder : public WebViewBenchmarkSupport::PaintClient { ...@@ -85,37 +84,6 @@ class SkPictureRecorder : public WebViewBenchmarkSupport::PaintClient {
namespace content { namespace content {
// Benchmark results object that populates a v8 array.
class V8BenchmarkResults : public content::RenderingBenchmarkResults {
public:
explicit V8BenchmarkResults()
: results_array_(v8::Array::New(0)) { }
virtual ~V8BenchmarkResults() {}
void AddResult(const std::string& benchmark_name,
const std::string& result_name,
const std::string& result_unit,
double result) {
v8::Handle<v8::Object> result_object = v8::Object::New();
result_object->Set(v8::String::New("benchmarkName", 13),
v8::String::New(benchmark_name.c_str(), -1));
result_object->Set(v8::String::New("resultName", 10),
v8::String::New(result_name.c_str(), -1));
result_object->Set(v8::String::New("resultUnit", 10),
v8::String::New(result_unit.c_str(), -1));
result_object->Set(v8::String::New("result", 6), v8::Number::New(result));
results_array_->Set(results_array_->Length(), result_object);
}
v8::Handle<v8::Array> results_array() {
return results_array_;
}
private:
v8::Handle<v8::Array> results_array_;
};
class GpuBenchmarkingWrapper : public v8::Extension { class GpuBenchmarkingWrapper : public v8::Extension {
public: public:
GpuBenchmarkingWrapper() : GpuBenchmarkingWrapper() :
...@@ -322,7 +290,7 @@ class GpuBenchmarkingWrapper : public v8::Extension { ...@@ -322,7 +290,7 @@ class GpuBenchmarkingWrapper : public v8::Extension {
ScopedVector<RenderingBenchmark> benchmarks = AllRenderingBenchmarks(); ScopedVector<RenderingBenchmark> benchmarks = AllRenderingBenchmarks();
V8BenchmarkResults results; v8::Handle<v8::Array> results = v8::Array::New(0);
ScopedVector<RenderingBenchmark>::const_iterator it; ScopedVector<RenderingBenchmark>::const_iterator it;
for (it = benchmarks.begin(); it != benchmarks.end(); it++) { for (it = benchmarks.begin(); it != benchmarks.end(); it++) {
RenderingBenchmark* benchmark = *it; RenderingBenchmark* benchmark = *it;
...@@ -332,11 +300,17 @@ class GpuBenchmarkingWrapper : public v8::Extension { ...@@ -332,11 +300,17 @@ class GpuBenchmarkingWrapper : public v8::Extension {
continue; continue;
} }
benchmark->SetUp(support); benchmark->SetUp(support);
benchmark->Run(&results, support); double result = benchmark->Run(support);
benchmark->TearDown(support); benchmark->TearDown(support);
v8::Handle<v8::Object> result_object = v8::Object::New();
result_object->Set(v8::String::New("benchmark", 9),
v8::String::New(name.c_str(), -1));
result_object->Set(v8::String::New("result", 6), v8::Number::New(result));
results->Set(results->Length(), result_object);
} }
return results.results_array(); return results;
} }
}; };
......
...@@ -23,8 +23,7 @@ class RenderingBenchmark { ...@@ -23,8 +23,7 @@ class RenderingBenchmark {
virtual void SetUp(WebKit::WebViewBenchmarkSupport* benchmarkSupport) {} virtual void SetUp(WebKit::WebViewBenchmarkSupport* benchmarkSupport) {}
virtual void Run(RenderingBenchmarkResults* results, virtual double Run(WebKit::WebViewBenchmarkSupport* benchmarkSupport) = 0;
WebKit::WebViewBenchmarkSupport* benchmarkSupport) = 0;
virtual void TearDown(WebKit::WebViewBenchmarkSupport* benchmarkSupport) {} virtual void TearDown(WebKit::WebViewBenchmarkSupport* benchmarkSupport) {}
......
// Copyright (c) 2012 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.
#ifndef CONTENT_RENDERER_RENDERING_BENCHMARK_RESULTS_H_
#define CONTENT_RENDERER_RENDERING_BENCHMARK_RESULTS_H_
#include <string>
#include "content/common/content_export.h"
namespace content {
class RenderingBenchmarkResults {
public:
virtual ~RenderingBenchmarkResults() { }
virtual void AddResult(const std::string& benchmark_name,
const std::string& result_name,
const std::string& result_unit,
double time) = 0;
};
} // namespace content
#endif // CONTENT_RENDERER_RENDERING_BENCHMARK_RESULTS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment