You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/10/08 09:26:28 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #7544: Return 0 in the response metadata when thread cpu time measurement is disabled

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



##########
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:
       This isn't really clear to me. Why should recording CPU time affect the wall time?




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org