Flutter Engine
The Flutter Engine
third_party
skia
bench
ControlBench.cpp
Go to the documentation of this file.
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
#include "
bench/Benchmark.h
"
9
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
13
struct
ControlBench
:
public
Benchmark
{
14
const
char
*
onGetName
()
override
{
return
"control"
; }
15
bool
isSuitableFor
(
Backend
backend
)
override
{
return
backend
==
Backend::kNonRendering
; }
16
17
void
onDraw
(
int
loops,
SkCanvas
*)
override
{
18
// Nothing terribly useful: force a memory read, a memory write, and some math.
19
[[maybe_unused]]
volatile
uint32_t rand = 0;
20
for
(
int
i
= 0;
i
< 1000*loops;
i
++) {
21
uint32_t val = rand * 1664525 + 1013904223;
22
rand = val;
23
}
24
}
25
};
26
DEF_BENCH
(
return
new
ControlBench
;)
Benchmark.h
DEF_BENCH
#define DEF_BENCH(code)
Definition:
Benchmark.h:20
backend
const char * backend
Definition:
CommonFlagsConfig.cpp:42
Benchmark
Definition:
Benchmark.h:36
Benchmark::Backend
Backend
Definition:
Benchmark.h:44
Benchmark::Backend::kNonRendering
@ kNonRendering
SkCanvas
Definition:
SkCanvas.h:106
i
int i
Definition:
fl_socket_accessible.cc:18
ControlBench
Definition:
ControlBench.cpp:13
ControlBench::onGetName
const char * onGetName() override
Definition:
ControlBench.cpp:14
ControlBench::onDraw
void onDraw(int loops, SkCanvas *) override
Definition:
ControlBench.cpp:17
ControlBench::isSuitableFor
bool isSuitableFor(Backend backend) override
Definition:
ControlBench.cpp:15
Generated on Sun Jun 23 2024 21:55:53 for Flutter Engine by
1.9.4