[flang][runtime] Make defined formatted I/O process format elementally (#74150)
[llvm-project.git] / libcxx / benchmarks / system_error.bench.cpp
blob4b0568d503bc5a5bcdeaa65d7cc61e4f90788302
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include <string>
10 #include <system_error>
12 #include "benchmark/benchmark.h"
14 static void BM_SystemErrorWithMessage(benchmark::State& state) {
15 for (auto _ : state) {
16 std::error_code ec{};
17 benchmark::DoNotOptimize(std::system_error{ec, ""});
20 BENCHMARK(BM_SystemErrorWithMessage);
22 static void BM_SystemErrorWithoutMessage(benchmark::State& state) {
23 for (auto _ : state) {
24 std::error_code ec{};
25 benchmark::DoNotOptimize(std::system_error{ec});
28 BENCHMARK(BM_SystemErrorWithoutMessage);
30 BENCHMARK_MAIN();