summaryrefslogtreecommitdiff
path: root/benchmarks/string_benchmark.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-11-08 23:28:57 -0800
committerChristopher Ferris <cferris@google.com>2017-11-30 15:49:45 -0800
commite2188d460b9356b84ec3a9113f03f0dd7ff43d32 (patch)
tree35c8d707b9833ec426cf5c442f60a5e4e4779bcd /benchmarks/string_benchmark.cpp
parentfdacec1d4237373354d10c5a400c9c7a3a975285 (diff)
Add new benchmark options.
Add a bunch of extra options to allow greater flexibility for creating benchmarks. Add a pattern option that can be used to represent any one buffer or two buffer possibility. This should fully replace the functionality of microbench. Add a single option for one buffer benchmarks and two buffer benchmarks that represents all of the possible options to run a string benchmark. Add a string test suite that includes all string benchmarks using the above option. Test: New unit tests to cover all the new options, and all pass. Test: Ran new string test suite with a single bionic iteration. Change-Id: Idb13ea15e44cec626e9f46672ccd648d7ca72ba6
Diffstat (limited to 'benchmarks/string_benchmark.cpp')
-rw-r--r--benchmarks/string_benchmark.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp
index 963592934..38122f2ed 100644
--- a/benchmarks/string_benchmark.cpp
+++ b/benchmarks/string_benchmark.cpp
@@ -187,6 +187,11 @@ static void BM_string_strcat_half_copy_half_seek(benchmark::State& state) {
const size_t src_alignment = state.range(1);
const size_t dst_alignment = state.range(2);
+ // Skip sizes that don't make sense.
+ if ((nbytes / 2) == 0) {
+ return;
+ }
+
std::vector<char> src;
std::vector<char> dst;
char* src_aligned = GetAlignedPtrFilled(&src, src_alignment, nbytes / 2, 'x');