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

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


The following commit(s) were added to refs/heads/cluster_tpc by this push:
     new 3fa038c  add timer for insert tablet
3fa038c is described below

commit 3fa038ce787b4cbf534245c6c41331ca9500a41f
Author: jt <[email protected]>
AuthorDate: Fri Oct 9 08:58:44 2020 +0800

    add timer for insert tablet
---
 .../main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java    | 7 +++++++
 server/src/main/java/org/apache/iotdb/db/utils/Timer.java          | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java 
b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index 52a3eba..a24b522 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -129,6 +129,8 @@ import org.apache.iotdb.db.query.executor.QueryRouter;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.AuthUtils;
 import org.apache.iotdb.db.utils.FileLoaderUtils;
+import org.apache.iotdb.db.utils.Timer;
+import org.apache.iotdb.db.utils.Timer.Statistic;
 import org.apache.iotdb.db.utils.UpgradeUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import 
org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
@@ -967,6 +969,10 @@ public class PlanExecutor implements IPlanExecutor {
 
   @Override
   public void insertTablet(InsertTabletPlan insertTabletPlan) throws 
QueryProcessException {
+    long start;
+    if (Timer.ENABLE_INSTRUMENTING) {
+      start = System.nanoTime();
+    }
     MNode deviceMNode = null;
     try {
       insertTabletPlan.setMeasurementMNodes(new 
MeasurementMNode[insertTabletPlan.getMeasurements().length]);
@@ -983,6 +989,7 @@ public class PlanExecutor implements IPlanExecutor {
         deviceMNode.readUnlock();
       }
     }
+    Statistic.INSERT_TABLET.addNanoFromStart(start);
   }
 
   private boolean operateAuthor(AuthorPlan author) throws 
QueryProcessException {
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/Timer.java 
b/server/src/main/java/org/apache/iotdb/db/utils/Timer.java
index b7bc4c8..1754eb5 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/Timer.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/Timer.java
@@ -186,7 +186,10 @@ public class Timer {
         CLOSE_FILE_MOVE_MEMTABLE_TO_FLUSH),
     CLOSE_FILE_REGISTER_FLUSH(
         STORAGE_ENGINE, "close file - register flush", TIME_SCALE, true,
-        CLOSE_FILE_MOVE_MEMTABLE_TO_FLUSH);
+        CLOSE_FILE_MOVE_MEMTABLE_TO_FLUSH),
+    INSERT_TABLET(
+        STORAGE_ENGINE, "insert tablet", TIME_SCALE, true,
+        ROOT);
 
 
     String className;

Reply via email to