jainankitk commented on code in PR #14413:
URL: https://github.com/apache/lucene/pull/14413#discussion_r2030073871


##########
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:
   I have added some changes to make it more explicit that the breakdowns are 
per thread and not per slice. Although, underlying class is still 
`QuerySliceProfileBreakdown` as it can be used for measuring slice level 
breakdown:
   
   ```
   "query": [ <-- for list of root queries
                 {
                   "type": "TermQuery",
                   "description": "foo:bar",
                   "startTime" : 11972972,
                   "totalTime": 354343,
                   "queryLevelBreakdowns" :   {.....}, <-- query level 
breakdown like weight count and time
                   "threadLevelBreakdowns": [
                   {.....},    <-- first thread information
                   {.....}]    <-- second thread information
                   "queryChildren": [
                   {......},  <-- recursive repetition of above structure
                   {......}]
   ```



-- 
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

Reply via email to