jainankitk commented on code in PR #14413: URL: https://github.com/apache/lucene/pull/14413#discussion_r2029297568
########## lucene/sandbox/src/java/org/apache/lucene/sandbox/search/QueryProfilerBreakdown.java: ########## @@ -17,46 +17,113 @@ package org.apache.lucene.sandbox.search; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import org.apache.lucene.search.Query; import org.apache.lucene.util.CollectionUtil; /** * A record of timings for the various operations that may happen during query execution. A node's * time may be composed of several internal attributes (rewriting, weighting, scoring, etc). */ class QueryProfilerBreakdown { - - /** The accumulated timings for this query node */ - private final QueryProfilerTimer[] timers; + private static final Collection<QueryProfilerTimingType> QUERY_LEVEL_TIMING_TYPE = + Arrays.stream(QueryProfilerTimingType.values()).filter(t -> !t.isSliceLevel()).toList(); + private final Map<QueryProfilerTimingType, QueryProfilerTimer> queryProfilerTimers; + private final ConcurrentMap<Long, QuerySliceProfilerBreakdown> threadToSliceBreakdown; Review Comment: > We should look into reliably identifying slices, or breaking down by thread rather than by slice? The code currently breaks down by thread only, even though it mentions slice. I incorrectly assumed that every slice is processed by unique thread, which need not be true. Thinking bit more on this, I feel breakdown by thread is good enough, as our primary intent is to understand the concurrent processing. If slice 1 and slice 2 are processed sequentially by thread A, it is actually better to aggregate that information as thread A breakdown instead of breakdown for slice 1 and slice 2. Thoughts? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org