26 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include <fstream>10#include <vector>11 12#include <benchmark/benchmark.h>13 14static void bm_write(benchmark::State& state) {15 std::vector<char> buffer;16 buffer.resize(16384);17 18 std::ofstream stream("/dev/null");19 20 for (auto _ : state)21 stream.write(buffer.data(), buffer.size());22}23BENCHMARK(bm_write);24 25BENCHMARK_MAIN();26