summaryrefslogtreecommitdiffstats
path: root/cc/debug/rasterize_and_record_benchmark.h
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 20:32:08 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 20:32:08 +0000
commit8cac9fe3496911e1e4dacd94cb2073b59cfa86d4 (patch)
treedf5f7a59c054fe7cc7316c2aff4a17a1a4ee64a3 /cc/debug/rasterize_and_record_benchmark.h
parent7b06b28ab5e49cc32075a9a28db6d91c381967a9 (diff)
downloadchromium_src-8cac9fe3496911e1e4dacd94cb2073b59cfa86d4.zip
chromium_src-8cac9fe3496911e1e4dacd94cb2073b59cfa86d4.tar.gz
chromium_src-8cac9fe3496911e1e4dacd94cb2073b59cfa86d4.tar.bz2
cc: Add rasterize and record micro benchmark.
This patch adds a rasterize and record micro benchmark. It depends on https://codereview.chromium.org/67563002/ R=enne@chromium.org, nduca@chromium.org, ernstm@chromium.org Review URL: https://codereview.chromium.org/66213007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235805 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug/rasterize_and_record_benchmark.h')
-rw-r--r--cc/debug/rasterize_and_record_benchmark.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/cc/debug/rasterize_and_record_benchmark.h b/cc/debug/rasterize_and_record_benchmark.h
new file mode 100644
index 0000000..2cea16a
--- /dev/null
+++ b/cc/debug/rasterize_and_record_benchmark.h
@@ -0,0 +1,66 @@
+// Copyright 2013 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 CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
+#define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
+
+#include <map>
+#include <utility>
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "cc/debug/micro_benchmark_controller.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace cc {
+
+class LayerTreeHost;
+class Layer;
+class RasterizeAndRecordBenchmark : public MicroBenchmark {
+ public:
+ explicit RasterizeAndRecordBenchmark(
+ scoped_ptr<base::Value> value,
+ const MicroBenchmark::DoneCallback& callback);
+ virtual ~RasterizeAndRecordBenchmark();
+
+ // Implements MicroBenchmark interface.
+ virtual void DidUpdateLayers(LayerTreeHost* host) OVERRIDE;
+ virtual void RunOnLayer(PictureLayer* layer) OVERRIDE;
+
+ virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl(
+ scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE;
+
+ private:
+ void Run(Layer* layer);
+
+ void RecordRasterResults(scoped_ptr<base::Value> results);
+
+ struct RecordResults {
+ RecordResults();
+ ~RecordResults();
+
+ int pixels_recorded;
+ base::TimeDelta total_best_time;
+ };
+
+ RecordResults record_results_;
+ int record_repeat_count_;
+ scoped_ptr<base::Value> settings_;
+ scoped_ptr<base::DictionaryValue> results_;
+
+ // The following is used in DCHECKs.
+ bool main_thread_benchmark_done_;
+
+ LayerTreeHost* host_;
+
+ base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_;
+};
+
+} // namespace cc
+
+#endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_