RenderNodeBench.cpp revision 3acf0382da22cda88234e599cd81b1ff5441cc35
13acf0382da22cda88234e599cd81b1ff5441cc35John Reck/*
23acf0382da22cda88234e599cd81b1ff5441cc35John Reck * Copyright (C) 2016 The Android Open Source Project
33acf0382da22cda88234e599cd81b1ff5441cc35John Reck *
43acf0382da22cda88234e599cd81b1ff5441cc35John Reck * Licensed under the Apache License, Version 2.0 (the "License");
53acf0382da22cda88234e599cd81b1ff5441cc35John Reck * you may not use this file except in compliance with the License.
63acf0382da22cda88234e599cd81b1ff5441cc35John Reck * You may obtain a copy of the License at
73acf0382da22cda88234e599cd81b1ff5441cc35John Reck *
83acf0382da22cda88234e599cd81b1ff5441cc35John Reck *      http://www.apache.org/licenses/LICENSE-2.0
93acf0382da22cda88234e599cd81b1ff5441cc35John Reck *
103acf0382da22cda88234e599cd81b1ff5441cc35John Reck * Unless required by applicable law or agreed to in writing, software
113acf0382da22cda88234e599cd81b1ff5441cc35John Reck * distributed under the License is distributed on an "AS IS" BASIS,
123acf0382da22cda88234e599cd81b1ff5441cc35John Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133acf0382da22cda88234e599cd81b1ff5441cc35John Reck * See the License for the specific language governing permissions and
143acf0382da22cda88234e599cd81b1ff5441cc35John Reck * limitations under the License.
153acf0382da22cda88234e599cd81b1ff5441cc35John Reck */
163acf0382da22cda88234e599cd81b1ff5441cc35John Reck
173acf0382da22cda88234e599cd81b1ff5441cc35John Reck#include <benchmark/benchmark.h>
183acf0382da22cda88234e599cd81b1ff5441cc35John Reck
193acf0382da22cda88234e599cd81b1ff5441cc35John Reck#include "RenderNode.h"
203acf0382da22cda88234e599cd81b1ff5441cc35John Reck
213acf0382da22cda88234e599cd81b1ff5441cc35John Reckusing namespace android;
223acf0382da22cda88234e599cd81b1ff5441cc35John Reckusing namespace android::uirenderer;
233acf0382da22cda88234e599cd81b1ff5441cc35John Reck
243acf0382da22cda88234e599cd81b1ff5441cc35John Reckvoid BM_RenderNode_create(benchmark::State& state) {
253acf0382da22cda88234e599cd81b1ff5441cc35John Reck    while (state.KeepRunning()) {
263acf0382da22cda88234e599cd81b1ff5441cc35John Reck        auto node = new RenderNode();
273acf0382da22cda88234e599cd81b1ff5441cc35John Reck        node->incStrong(0);
283acf0382da22cda88234e599cd81b1ff5441cc35John Reck        benchmark::DoNotOptimize(node);
293acf0382da22cda88234e599cd81b1ff5441cc35John Reck        node->decStrong(0);
303acf0382da22cda88234e599cd81b1ff5441cc35John Reck    }
313acf0382da22cda88234e599cd81b1ff5441cc35John Reck}
323acf0382da22cda88234e599cd81b1ff5441cc35John ReckBENCHMARK(BM_RenderNode_create);
333acf0382da22cda88234e599cd81b1ff5441cc35John Reck
34