This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch FIDig
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/FIDig by this push:
     new f50a47f1e0 Add FI cost
f50a47f1e0 is described below

commit f50a47f1e03656efb7d646cbba13280309c987ee
Author: JackieTien97 <[email protected]>
AuthorDate: Tue Apr 11 10:32:41 2023 +0800

    Add FI cost
---
 .../iotdb/db/mpp/execution/fragment/FragmentInstanceContext.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceContext.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceContext.java
index 7e6257ef20..97a6ec341f 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceContext.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceContext.java
@@ -29,6 +29,7 @@ import org.apache.iotdb.db.mpp.common.FragmentInstanceId;
 import org.apache.iotdb.db.mpp.common.SessionInfo;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
+import org.apache.iotdb.db.utils.SetThreadName;
 import org.apache.iotdb.tsfile.read.filter.basic.Filter;
 
 import org.slf4j.Logger;
@@ -171,7 +172,7 @@ public class FragmentInstanceContext extends QueryContext {
   }
 
   private void updateStatsIfDone(FragmentInstanceState newState) {
-    if (newState.isDone()) {
+    if (newState == FragmentInstanceState.FLUSHING || newState.isDone()) {
       long now = System.currentTimeMillis();
 
       // before setting the end times, make sure a start has been recorded
@@ -185,6 +186,11 @@ public class FragmentInstanceContext extends QueryContext {
       // were a duplicate notification, which shouldn't happen
       executionEndTime.compareAndSet(END_TIME_INITIAL_VALUE, now);
       endNanos.compareAndSet(0, System.nanoTime());
+      if (dataRegion != null) {
+        try (SetThreadName threadName = new SetThreadName(id.getFullId())) {
+          LOGGER.info("FI cost: {}ms", (endNanos.get() - startNanos.get()) / 
1_000 / 1_000);
+        }
+      }
     }
   }
 

Reply via email to