-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow AddRange to work with int64_t. (#548)
* Allow AddRange to work with int64_t. Fixes #516 Also, tweak how we manage per-test build needs, and create a standard _gtest suffix for googletest to differentiate from non-googletest tests. I also ran clang-format on the files that I changed (but not the benchmark include or main src as they have too many clang-format issues). * Add benchmark_gtest to cmake * Set(Items|Bytes)Processed now take int64_t
- Loading branch information
1 parent
e7eb54b
commit 9913418
Showing
13 changed files
with
191 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef BENCHMARK_REGISTER_H | ||
#define BENCHMARK_REGISTER_H | ||
|
||
#include <vector> | ||
|
||
#include "check.h" | ||
|
||
template <typename T> | ||
void AddRange(std::vector<T>* dst, T lo, T hi, int mult) { | ||
CHECK_GE(lo, 0); | ||
CHECK_GE(hi, lo); | ||
CHECK_GE(mult, 2); | ||
|
||
// Add "lo" | ||
dst->push_back(lo); | ||
|
||
static const T kmax = std::numeric_limits<T>::max(); | ||
|
||
// Now space out the benchmarks in multiples of "mult" | ||
for (T i = 1; i < kmax / mult; i *= mult) { | ||
if (i >= hi) break; | ||
if (i > lo) { | ||
dst->push_back(i); | ||
} | ||
} | ||
|
||
// Add "hi" (if different from "lo") | ||
if (hi != lo) { | ||
dst->push_back(hi); | ||
} | ||
} | ||
|
||
#endif // BENCHMARK_REGISTER_H |
Oops, something went wrong.