Flutter Engine
styled_runs_benchmarks.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Google, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "flutter/fml/command_line.h"
18 #include "flutter/fml/logging.h"
19 #include "flutter/third_party/txt/tests/txt_test_utils.h"
20 #include "third_party/benchmark/include/benchmark/benchmark_api.h"
21 #include "txt/styled_runs.h"
22 #include "txt/text_style.h"
23 
24 namespace txt {
25 
26 static void BM_StyledRunsGetRun(benchmark::State& state) {
27  StyledRuns runs;
28  TextStyle style;
29  runs.AddStyle(style);
30  runs.StartRun(0, 0);
31  runs.EndRunIfNeeded(11);
32  while (state.KeepRunning()) {
33  runs.GetRun(0);
34  }
35 }
37 
38 } // namespace txt
size_t AddStyle(const TextStyle &style)
Definition: styled_runs.cc:44
void StartRun(size_t style_index, size_t start)
Definition: styled_runs.cc:54
void EndRunIfNeeded(size_t end)
Definition: styled_runs.cc:59
BENCHMARK(BM_PaintRecordInit)
Run GetRun(size_t index) const
Definition: styled_runs.cc:71
static void BM_StyledRunsGetRun(benchmark::State &state)