summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/tests/queryeval/iterator_benchmark/common.cpp')
-rw-r--r--searchlib/src/tests/queryeval/iterator_benchmark/common.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp b/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp
index c67a5ee1074..d2b5ec2cb8b 100644
--- a/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp
+++ b/searchlib/src/tests/queryeval/iterator_benchmark/common.cpp
@@ -1,6 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "common.h"
+#include <vespa/searchlib/queryeval/blueprint.h>
#include <sstream>
using search::attribute::CollectionType;
@@ -42,6 +43,38 @@ to_string(QueryOperator query_op)
namespace {
+std::string
+delete_substr_from(const std::string& source, const std::string& substr)
+{
+ std::string res = source;
+ auto i = res.find(substr);
+ while (i != std::string::npos) {
+ res.erase(i, substr.length());
+ i = res.find(substr, i);
+ }
+ return res;
+}
+
+}
+
+vespalib::string
+get_class_name(const auto& obj)
+{
+ auto res = obj.getClassName();
+ res = delete_substr_from(res, "search::attribute::");
+ res = delete_substr_from(res, "search::queryeval::");
+ res = delete_substr_from(res, "vespalib::btree::");
+ res = delete_substr_from(res, "search::");
+ res = delete_substr_from(res, "vespalib::");
+ res = delete_substr_from(res, "anonymous namespace");
+ return res;
+}
+
+template vespalib::string get_class_name<Blueprint>(const Blueprint& obj);
+template vespalib::string get_class_name<SearchIterator>(const SearchIterator& obj);
+
+namespace {
+
// TODO: Make seed configurable.
constexpr uint32_t default_seed = 1234;
std::mt19937 gen(default_seed);