blob: f8e15c9711c4af791e31e4b90db73755a8fe2d56 [file] [log] [blame]
mtklein44d43d82015-05-06 12:42:04 -07001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "bench/Benchmark.h"
mtklein44d43d82015-05-06 12:42:04 -07009
10// This benchmark's runtime should be fairly constant for a given machine,
11// so it can be used as a baseline to control for thermal or other throttling.
12
13struct ControlBench : public Benchmark {
14 const char* onGetName() override { return "control"; }
15 bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
16
mtkleina1ebeb22015-10-01 09:43:39 -070017 void onDraw(int loops, SkCanvas*) override {
mtklein44d43d82015-05-06 12:42:04 -070018 // Nothing terribly useful: force a memory read, a memory write, and some math.
19 volatile uint32_t rand = 0;
20 for (int i = 0; i < 1000*loops; i++) {
21 rand *= 1664525;
22 rand += 1013904223;
23 }
24 }
25};
26DEF_BENCH(return new ControlBench;)