33 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// UNSUPPORTED: c++0310 11#include <string>12#include <system_error>13 14#include "benchmark/benchmark.h"15 16static void BM_SystemErrorWithMessage(benchmark::State& state) {17 for (auto _ : state) {18 std::error_code ec{};19 benchmark::DoNotOptimize(std::system_error{ec, ""});20 }21}22BENCHMARK(BM_SystemErrorWithMessage);23 24static void BM_SystemErrorWithoutMessage(benchmark::State& state) {25 for (auto _ : state) {26 std::error_code ec{};27 benchmark::DoNotOptimize(std::system_error{ec});28 }29}30BENCHMARK(BM_SystemErrorWithoutMessage);31 32BENCHMARK_MAIN();33