Skip to content

Commit

Permalink
Merge 4024b29 into c9311a4
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Nov 26, 2018
2 parents c9311a4 + 4024b29 commit d342a80
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/benchmark_register.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ bool BenchmarkFamilies::FindBenchmarks(
}
}

instance.name += StrFormat("%d", arg);
instance.name += StrFormat("%ld", arg);
++arg_i;
}

if (!IsZero(family->min_time_))
instance.name += StrFormat("/min_time:%0.3f", family->min_time_);
if (family->iterations_ != 0)
instance.name += StrFormat("/iterations:%d", family->iterations_);
instance.name += StrFormat("/iterations:%zu", family->iterations_);
if (family->repetitions_ != 0)
instance.name += StrFormat("/repeats:%d", family->repetitions_);

Expand Down
6 changes: 5 additions & 1 deletion src/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ void AppendHumanReadable(int n, std::string* str);

std::string HumanReadableNumber(double n, double one_k = 1024.0);

std::string StrFormat(const char* format, ...);
#ifdef __GNUC__
__attribute__((format(printf, 1, 2)))
#endif
std::string
StrFormat(const char* format, ...);

inline std::ostream& StrCatImp(std::ostream& out) BENCHMARK_NOEXCEPT {
return out;
Expand Down
14 changes: 14 additions & 0 deletions test/reporter_output_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ ADD_CASES(TC_JSONOut,
{"\"run_type\": \"iteration\",$", MR_Next}});
ADD_CASES(TC_CSVOut, {{"^\"BM_arg_names/first:2/5/third:4\",%csv_report$"}});

// ========================================================================= //
// ------------------------ Testing Big Args Output ------------------------ //
// ========================================================================= //

void BM_BigArgs(benchmark::State& state) {
for (auto _ : state) {
}
}
BENCHMARK(BM_BigArgs)->RangeMultiplier(2)->Range(1UL << 30UL, 1UL << 33UL);
ADD_CASES(TC_ConsoleOut, {{"^BM_BigArgs/1073741824 %console_report$"},
{"^BM_BigArgs/2147483648 %console_report$"},
{"^BM_BigArgs/4294967296 %console_report$"},
{"^BM_BigArgs/8589934592 %console_report$"}});

// ========================================================================= //
// ----------------------- Testing Complexity Output ----------------------- //
// ========================================================================= //
Expand Down

0 comments on commit d342a80

Please sign in to comment.