Go to the documentation of this file.
7 #include "benchmark/benchmark.h"
12 #define ADD_COMPLEXITY_CASES(...) \
13 int CONCAT(dummy, __LINE__) = AddComplexityTest(__VA_ARGS__)
18 {
"%rms_name", rms_test_name},
19 {
"%bigo_str",
"[ ]* %float " + big_o},
21 {
"%rms",
"[ ]*[0-9]+ %"}});
24 {{
"^%bigo_name %bigo_str %bigo_str[ ]*$"},
26 {
"^%rms_name %rms %rms[ ]*$",
MR_Next}});
28 {
"\"cpu_coefficient\": [0-9]+,$",
MR_Next},
29 {
"\"real_coefficient\": [0-9]{1,5},$",
MR_Next},
30 {
"\"big_o\": \"%bigo\",$",
MR_Next},
31 {
"\"time_unit\": \"ns\"$",
MR_Next},
33 {
"\"name\": \"%rms_name\",$"},
36 AddCases(
TC_CSVOut, {{
"^\"%bigo_name\",,%float,%float,%bigo,,,,,$"},
37 {
"^\"%bigo_name\"",
MR_Not},
38 {
"^\"%rms_name\",,%float,%float,,,,,,$",
MR_Next}});
49 while (
state.KeepRunning()) {
50 for (
int i = 0;
i < 1024; ++
i) {
87 for (
int i = 0;
i <
size; ++
i) {
88 v.push_back(std::rand() %
size);
95 const int item_not_in_vector =
97 while (
state.KeepRunning()) {
104 ->Range(1 << 10, 1 << 16)
108 ->Range(1 << 10, 1 << 16)
109 ->Complexity([](
int n) ->
double {
return n; });
112 ->Range(1 << 10, 1 << 16)
132 while (
state.KeepRunning()) {
133 std::sort(
v.begin(),
v.end());
139 ->Range(1 << 10, 1 << 16)
143 ->Range(1 << 10, 1 << 16)
144 ->Complexity([](
int n) {
return n * log2(
n); });
147 ->Range(1 << 10, 1 << 16)
#define ADD_COMPLEXITY_CASES(...)
const char * lambda_big_o_1
static void BM_Complexity_O_N_log_N(benchmark::State &state)
static void ** find(grpc_chttp2_stream_map *map, uint32_t key)
BENCHMARK(BM_Complexity_O1) -> Range(1, 1<< 18) ->Complexity(benchmark::o1)
std::vector< int > ConstructRandomVector(int size)
BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const &value)
int SetSubstitutions(std::initializer_list< std::pair< std::string, std::string >> il)
const char * lambda_big_o_n
const char * enum_auto_big_o_n
const char * rms_o_n_test_name
int AddCases(TestCaseID ID, std::initializer_list< TestCase > il)
const char * rms_o_n_lg_n_test_name
const char * big_o_n_test_name
const char * enum_big_o_1
void RunOutputTests(int argc, char *argv[])
void BM_Complexity_O1(benchmark::State &state)
int main(int argc, char *argv[])
const char * big_o_1_test_name
const char * lambda_big_o_n_lg_n
const char * enum_auto_big_o_n_lg_n
void BM_Complexity_O_N(benchmark::State &state)
const char * big_o_n_lg_n_test_name
const char * rms_o_1_test_name
const char * auto_big_o_1
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:00