forked from google/benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*Display* aggregates only. (google#665)
There is a flag https://github.com/google/benchmark/blob/d9cab612e40017af10bddaa5b60c7067032a9e1c/src/benchmark.cc#L75-L78 and a call https://github.com/google/benchmark/blob/d9cab612e40017af10bddaa5b60c7067032a9e1c/include/benchmark/benchmark.h#L837-L840 But that affects everything, every reporter, destination: https://github.com/google/benchmark/blob/d9cab612e40017af10bddaa5b60c7067032a9e1c/src/benchmark.cc#L316 It would be quite useful to have an ability to be more picky. More specifically, i would like to be able to only see the aggregates in the on-screen output, but for the file output to still contain everything. The former is useful in case of a lot of repetition (or even more so if every iteration is reported separately), while the former is **great** for tooling. Fixes google#664
- Loading branch information
Showing
10 changed files
with
270 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
#undef NDEBUG | ||
#include <cstdio> | ||
#include <string> | ||
|
||
#include "benchmark/benchmark.h" | ||
#include "output_test.h" | ||
|
||
// Ok this test is super ugly. We want to check what happens with the file | ||
// reporter in the presence of DisplayAggregatesOnly(). | ||
// We do not care about console output, the normal tests check that already. | ||
|
||
void BM_SummaryRepeat(benchmark::State& state) { | ||
for (auto _ : state) { | ||
} | ||
} | ||
BENCHMARK(BM_SummaryRepeat)->Repetitions(3)->DisplayAggregatesOnly(); | ||
|
||
int main(int argc, char* argv[]) { | ||
const std::string output = GetFileReporterOutput(argc, argv); | ||
|
||
if (SubstrCnt(output, "BM_SummaryRepeat/repeats:3") != 6 || | ||
SubstrCnt(output, "\"BM_SummaryRepeat/repeats:3\"") != 3 || | ||
SubstrCnt(output, "\"BM_SummaryRepeat/repeats:3_mean\"") != 1 || | ||
SubstrCnt(output, "\"BM_SummaryRepeat/repeats:3_median\"") != 1 || | ||
SubstrCnt(output, "\"BM_SummaryRepeat/repeats:3_stddev\"") != 1) { | ||
std::cout << "Precondition mismatch. Expected to only find 6 " | ||
"occurrences of \"BM_SummaryRepeat/repeats:3\" substring:\n" | ||
"\"BM_SummaryRepeat/repeats:3\", " | ||
"\"BM_SummaryRepeat/repeats:3\", " | ||
"\"BM_SummaryRepeat/repeats:3\", " | ||
"\"BM_SummaryRepeat/repeats:3_mean\", " | ||
"\"BM_SummaryRepeat/repeats:3_median\", " | ||
"\"BM_SummaryRepeat/repeats:3_stddev\"\nThe entire output:\n"; | ||
std::cout << output; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.