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

Side by Side Diff: bench/PictureOverheadBench.cpp

Issue 1061633002: Add a bench to measure SkPictureRecorder constant overhead. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: compiles Created 5 years, 8 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
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 // A benchmark designed to isolate the constant overheads of picture recording.
9 // We record a very tiny (one op) picture; one op is better than none, as it for ces
10 // us to allocate memory to store that op... we can't just cheat by holding onto NULLs.
11
12 #include "Benchmark.h"
13 #include "SkCanvas.h"
14 #include "SkPictureRecorder.h"
15
16 struct PictureOverheadBench : public Benchmark {
17 const char* onGetName() override { return "picture_overhead"; }
18 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
19
20 void onDraw(const int loops, SkCanvas*) override {
21 SkPictureRecorder rec;
22 for (int i = 0; i < loops; i++) {
23 SkCanvas* c = rec.beginRecording(SkRect::MakeWH(2000,3000));
24 c->drawRect(SkRect::MakeXYWH(10, 10, 1000, 1000), SkPaint());
25 SkAutoTUnref<SkPicture> pic(rec.endRecordingAsPicture());
26 }
27 }
28 };
29 DEF_BENCH(return new PictureOverheadBench;)
OLDNEW
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698