richardstartin commented on a change in pull request #7544:
URL: https://github.com/apache/pinot/pull/7544#discussion_r725192663



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/InstanceResponseOperator.java
##########
@@ -19,61 +19,64 @@
 package org.apache.pinot.core.operator;
 
 import java.util.List;
-import org.apache.pinot.common.utils.DataTable;
 import org.apache.pinot.common.utils.DataTable.MetadataKey;
-import org.apache.pinot.core.common.Operator;
 import org.apache.pinot.core.operator.blocks.InstanceResponseBlock;
 import org.apache.pinot.core.operator.blocks.IntermediateResultsBlock;
+import org.apache.pinot.core.operator.combine.BaseCombineOperator;
+import org.apache.pinot.core.query.request.context.ThreadTimer;
 import org.apache.pinot.segment.spi.FetchContext;
 import org.apache.pinot.segment.spi.IndexSegment;
 
 
 public class InstanceResponseOperator extends 
BaseOperator<InstanceResponseBlock> {
   private static final String OPERATOR_NAME = "InstanceResponseOperator";
 
-  private final Operator _operator;
+  private final BaseCombineOperator _combineOperator;
   private final List<IndexSegment> _indexSegments;
   private final List<FetchContext> _fetchContexts;
   private final int _fetchContextSize;
 
-  public InstanceResponseOperator(Operator combinedOperator, 
List<IndexSegment> indexSegments,
+  public InstanceResponseOperator(BaseCombineOperator combinedOperator, 
List<IndexSegment> indexSegments,
       List<FetchContext> fetchContexts) {
-    _operator = combinedOperator;
+    _combineOperator = combinedOperator;
     _indexSegments = indexSegments;
     _fetchContexts = fetchContexts;
     _fetchContextSize = fetchContexts.size();
   }
 
   @Override
   protected InstanceResponseBlock getNextBlock() {
-    long startWallClockTimeNs = System.nanoTime();
+    if (ThreadTimer.isThreadCpuTimeMeasurementEnabled()) {
+      long startWallClockTimeNs = System.nanoTime();
+      IntermediateResultsBlock intermediateResultsBlock = getCombinedResults();
+      InstanceResponseBlock instanceResponseBlock = new 
InstanceResponseBlock(intermediateResultsBlock);
+      long totalWallClockTimeNs = System.nanoTime() - startWallClockTimeNs;
 
-    IntermediateResultsBlock intermediateResultsBlock;
+      /*
+       * If/when the threadCpuTime based instrumentation is done for other 
parts of execution (planning, pruning etc),
+       * we will have to change the wallClockTime computation accordingly. 
Right now everything under
+       * InstanceResponseOperator is the one that is instrumented with 
threadCpuTime.
+       */

Review comment:
       To be honest I think wall time should include time spent recording CPU 
time, which would quickly reveal how expensive it is to record CPU time at fine 
granularity.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to