summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@yahooinc.com>2023-01-19 15:22:39 +0000
committerHåvard Pettersen <havardpe@yahooinc.com>2023-01-19 16:05:54 +0000
commit79ff30cd9ec64651af8deda8f6800c1234e79449 (patch)
tree7e70b512a97fd9e2f97ac6d8e2a09e7fd8ac6493 /searchcore
parent8b3aecc4e3129f7a3cb8bab0dc4eb9f4c6701578 (diff)
separate profiling depth parameters
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp25
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp5
5 files changed, 25 insertions, 18 deletions
diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
index dd2396e5f34..45ac0a8f924 100644
--- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
@@ -318,7 +318,7 @@ TEST("require that the match phase limiter is able to pre-limit the query") {
EXPECT_TRUE(limiter.is_enabled());
EXPECT_EQUAL(12u, limiter.sample_hits_per_thread(10));
RelativeTime clock(std::make_unique<CountingClock>(vespalib::count_ns(10000000s), 1700000L));
- Trace trace(clock, 7, 0);
+ Trace trace(clock, 7);
trace.start(4, false);
SearchIterator::UP search = limiter.maybe_limit(prepare(new MockSearch("search")), 0.1, 100000, trace.maybeCreateCursor(7, "limit"));
limiter.updateDocIdSpaceEstimate(1000, 9000);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 063666e9cad..4450b34296b 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -105,11 +105,10 @@ MatchMaster::match(search::engine::Trace & trace,
std::vector<MatchThread::UP> threadState;
for (size_t i = 0; i < threadBundle.size(); ++i) {
IMatchLoopCommunicator &com = (i == 0)
- ? static_cast<IMatchLoopCommunicator&>(timedCommunicator)
- : static_cast<IMatchLoopCommunicator&>(communicator);
+ ? static_cast<IMatchLoopCommunicator&>(timedCommunicator)
+ : static_cast<IMatchLoopCommunicator&>(communicator);
threadState.emplace_back(std::make_unique<MatchThread>(i, threadBundle.size(), params, mtf, com, *scheduler,
- resultProcessor, mergeDirector, distributionKey,
- trace.getRelativeTime(), trace.getLevel(), trace.getProfileDepth()));
+ resultProcessor, mergeDirector, distributionKey, trace));
}
resultProcessor.prepareThreadContextCreation(threadBundle.size());
threadBundle.run(threadState);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 0463568213b..620e4f1ff1d 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -403,10 +403,8 @@ MatchThread::MatchThread(size_t thread_id_in,
ResultProcessor &rp,
vespalib::DualMergeDirector &md,
uint32_t distributionKey,
- const RelativeTime & relativeTime,
- uint32_t traceLevel,
- uint32_t profileDepth) :
- thread_id(thread_id_in),
+ const Trace &parent_trace)
+ : thread_id(thread_id_in),
num_threads(num_threads_in),
matchParams(mp),
matchToolsFactory(mtf),
@@ -422,16 +420,25 @@ MatchThread::MatchThread(size_t thread_id_in,
match_time_s(0.0),
wait_time_s(0.0),
match_with_ranking(mtf.has_first_phase_rank() && mp.save_rank_scores()),
- trace(std::make_unique<Trace>(relativeTime, traceLevel, profileDepth)),
+ trace(std::make_unique<Trace>(parent_trace.getRelativeTime(), parent_trace.getLevel())),
match_profiler(),
first_phase_profiler(),
second_phase_profiler(),
my_issues()
{
- if ((traceLevel > 0) && (profileDepth > 0)) {
- match_profiler = std::make_unique<vespalib::ExecutionProfiler>(profileDepth);
- first_phase_profiler = std::make_unique<vespalib::ExecutionProfiler>(profileDepth);
- second_phase_profiler = std::make_unique<vespalib::ExecutionProfiler>(profileDepth);
+ trace->match_profile_depth(parent_trace.match_profile_depth());
+ trace->first_phase_profile_depth(parent_trace.first_phase_profile_depth());
+ trace->second_phase_profile_depth(parent_trace.second_phase_profile_depth());
+ if (trace->getLevel() > 0) {
+ if (int32_t depth = trace->match_profile_depth(); depth != 0) {
+ match_profiler = std::make_unique<vespalib::ExecutionProfiler>(depth);
+ }
+ if (int32_t depth = trace->first_phase_profile_depth(); depth != 0) {
+ first_phase_profiler = std::make_unique<vespalib::ExecutionProfiler>(depth);
+ }
+ if (int32_t depth = trace->second_phase_profile_depth(); depth != 0) {
+ second_phase_profiler = std::make_unique<vespalib::ExecutionProfiler>(depth);
+ }
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index 3f97bfe4f08..757caae0e75 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -131,9 +131,7 @@ public:
ResultProcessor &rp,
vespalib::DualMergeDirector &md,
uint32_t distributionKey,
- const RelativeTime & relativeTime,
- uint32_t traceLevel,
- uint32_t profileDepth);
+ const Trace &parent_trace);
void run() override;
const MatchingStats::Partition &get_thread_stats() const { return thread_stats; }
double get_match_time() const { return match_time_s; }
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index 8894473dcc7..86b21445919 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -186,7 +186,10 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
_diversityParams(),
_valid(false)
{
- search::engine::Trace trace(root_trace.getRelativeTime(), root_trace.getLevel(), root_trace.getProfileDepth());
+ search::engine::Trace trace(root_trace.getRelativeTime(), root_trace.getLevel());
+ trace.match_profile_depth(root_trace.match_profile_depth());
+ trace.first_phase_profile_depth(root_trace.first_phase_profile_depth());
+ trace.second_phase_profile_depth(root_trace.second_phase_profile_depth());
trace.addEvent(4, "Start query setup");
_query.setWhiteListBlueprint(metaStore.createWhiteListBlueprint());
trace.addEvent(5, "Deserialize and build query tree");