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 @@
'renderer/renderer_webkitplatformsupport_impl.h',
'renderer/rendering_benchmark.cc',
'renderer/rendering_benchmark.h',
'renderer/rendering_benchmark_results.h',
'renderer/speech_recognition_dispatcher.cc',
'renderer/speech_recognition_dispatcher.h',
'renderer/text_input_client_observer.cc',
......
......@@ -14,7 +14,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "content/renderer/rendering_benchmark.h"
#include "content/renderer/rendering_benchmark_results.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/utils/SkNullCanvas.h"
......@@ -54,14 +53,10 @@ class CustomPaintBenchmark
delete canvas;
}
virtual void Run(content::RenderingBenchmarkResults* results,
WebViewBenchmarkSupport* support) OVERRIDE {
virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
paint_time_total_ = TimeDelta();
support->paint(this, paint_mode_);
results->AddResult(name(),
"paintTime",
"s",
paint_time_total_.InSecondsF());
return paint_time_total_.InMillisecondsF();
}
private:
......@@ -84,30 +79,45 @@ class BitmapCanvasPaintBenchmark : public CustomPaintBenchmark {
}
};
class NullCanvasPaintBenchmark : public CustomPaintBenchmark {
class CanvasCountBenchmark
: public content::RenderingBenchmark,
public WebViewBenchmarkSupport::PaintClient {
public:
NullCanvasPaintBenchmark(const std::string& name,
WebViewBenchmarkSupport::PaintMode paint_mode)
: CustomPaintBenchmark(name, paint_mode),
canvas_count_(0) { }
CanvasCountBenchmark(const std::string& name,
WebViewBenchmarkSupport::PaintMode paint_mode)
: content::RenderingBenchmark(name),
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,
WebViewBenchmarkSupport* support) OVERRIDE {
virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
canvas_count_ = 0;
CustomPaintBenchmark::Run(results, support);
results->AddResult(name(),
"canvasCount",
"i",
canvas_count_);
support->paint(this, paint_mode_);
return 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:
virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE {
++canvas_count_;
return SkCreateNullCanvas();
}
int canvas_count_;
};
class SkPicturePaintBenchmark : public CustomPaintBenchmark {
......@@ -163,14 +173,10 @@ class TiledReplayBenchmark
}
}
virtual void Run(content::RenderingBenchmarkResults* results,
WebViewBenchmarkSupport* support) {
virtual double Run(WebViewBenchmarkSupport* support) {
paint_time_total_ = TimeDelta();
support->paint(this, paint_mode_);
results->AddResult(name(),
"repaintTime",
"s",
paint_time_total_.InSecondsF());
return paint_time_total_.InMillisecondsF();
}
private:
......@@ -239,40 +245,43 @@ namespace content {
ScopedVector<RenderingBenchmark> AllRenderingBenchmarks() {
ScopedVector<RenderingBenchmark> benchmarks;
benchmarks.push_back(new BitmapCanvasPaintBenchmark(
"PaintEverythingToBitmap",
"PaintEverythingToBitmapMs",
WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new NullCanvasPaintBenchmark(
"PaintEverythingToNullCanvas",
"PaintEverythingToNullCanvasMs",
WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new CanvasCountBenchmark(
"LayerCount",
WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new SkPicturePaintBenchmark(
"PaintEverythingToSkPicture",
"PaintEverythingToSkPictureMs",
WebViewBenchmarkSupport::PaintModeEverything));
benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo256x256Bitmap",
"RepaintEverythingTo256x256BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
256));
benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo128x128Bitmap",
"RepaintEverythingTo128x128BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
128));
benchmarks.push_back(new SquareTiledReplayBenchmark(
"RepaintEverythingTo512x512Bitmap",
"RepaintEverythingTo512x512BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
512));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx256Bitmap",
"RepaintEverythingToLayerWidthx256BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
256));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx128Bitmap",
"RepaintEverythingToLayerWidthx128BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
128));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx64Bitmap",
"RepaintEverythingToLayerWidthx64BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
64));
benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
"RepaintEverythingToLayerWidthx512Bitmap",
"RepaintEverythingToLayerWidthx512BitmapMs",
WebViewBenchmarkSupport::PaintModeEverything,
512));
return benchmarks.Pass();
......
......@@ -14,7 +14,6 @@
#include "content/renderer/all_rendering_benchmarks.h"
#include "content/renderer/render_view_impl.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/SkPicture.h"
#include "third_party/skia/include/core/SkStream.h"
......@@ -85,37 +84,6 @@ class SkPictureRecorder : public WebViewBenchmarkSupport::PaintClient {
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 {
public:
GpuBenchmarkingWrapper() :
......@@ -322,7 +290,7 @@ class GpuBenchmarkingWrapper : public v8::Extension {
ScopedVector<RenderingBenchmark> benchmarks = AllRenderingBenchmarks();
V8BenchmarkResults results;
v8::Handle<v8::Array> results = v8::Array::New(0);
ScopedVector<RenderingBenchmark>::const_iterator it;
for (it = benchmarks.begin(); it != benchmarks.end(); it++) {
RenderingBenchmark* benchmark = *it;
......@@ -332,11 +300,17 @@ class GpuBenchmarkingWrapper : public v8::Extension {
continue;
}
benchmark->SetUp(support);
benchmark->Run(&results, support);
double result = benchmark->Run(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 {
virtual void SetUp(WebKit::WebViewBenchmarkSupport* benchmarkSupport) {}
virtual void Run(RenderingBenchmarkResults* results,
WebKit::WebViewBenchmarkSupport* benchmarkSupport) = 0;
virtual double Run(WebKit::WebViewBenchmarkSupport* benchmarkSupport) = 0;
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