#include "user.hpp"
#include <benchmark/benchmark.h>
#include <iostream>
#include <sstream>
Go to the source code of this file.
◆ BENCHMARK() [1/2]
◆ BENCHMARK() [2/2]
◆ BENCHMARK_MAIN()
◆ BM_UserConstructor()
static void BM_UserConstructor |
( |
const benchmark::State & | state | ) |
|
|
static |
Definition at line 8 of file c++/benchmarks/bench_user.cpp.
8 {
10
11 benchmark::DoNotOptimize(
12 User(
"octocat",
"The Octocat",
"GitHub",
"San Francisco"));
13 }
14}
Structure representing a GitHub user.
References _.
◆ BM_UserPrint()
static void BM_UserPrint |
( |
const benchmark::State & | state | ) |
|
|
static |
Definition at line 18 of file c++/benchmarks/bench_user.cpp.
18 {
19 User user(
"octocat",
"The Octocat",
"GitHub",
"San Francisco");
20
21 for (
auto _ : state) {
22 std::ostringstream oss;
23 std::streambuf *old = std::cout.rdbuf(oss.rdbuf());
24 user.print();
25 std::cout.rdbuf(old);
26
27 benchmark::DoNotOptimize(oss.str());
28 }
29}
References _.