You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/08/02 12:27:26 UTC

[iotdb] branch ml_0729_test_exp1 updated: add steptracker for build requests

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

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


The following commit(s) were added to refs/heads/ml_0729_test_exp1 by this push:
     new 6f0bfc13ed add steptracker for build requests
6f0bfc13ed is described below

commit 6f0bfc13edb49a4fe5b6bb238cec4b2e8b7dc753
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Aug 2 20:27:12 2022 +0800

    add steptracker for build requests
---
 .../consensus/common/request/IndexedConsensusRequest.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/common/request/IndexedConsensusRequest.java b/consensus/src/main/java/org/apache/iotdb/consensus/common/request/IndexedConsensusRequest.java
index 1a61cf3a09..9ce706d09a 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/common/request/IndexedConsensusRequest.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/common/request/IndexedConsensusRequest.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.consensus.common.request;
 
+import org.apache.iotdb.commons.StepTracker;
+
 import java.nio.ByteBuffer;
 import java.util.LinkedList;
 import java.util.List;
@@ -67,9 +69,14 @@ public class IndexedConsensusRequest implements IConsensusRequest {
   }
 
   public List<ByteBuffer> buildSerializedRequests() {
-    List<ByteBuffer> result = new LinkedList<>();
-    this.requests.forEach(r -> result.add(r.serializeToByteBuffer()));
-    return result;
+    long startTime = System.nanoTime();
+    try {
+      List<ByteBuffer> result = new LinkedList<>();
+      this.requests.forEach(r -> result.add(r.serializeToByteBuffer()));
+      return result;
+    } finally {
+      StepTracker.trace("buildSerializedRequests", startTime, System.nanoTime());
+    }
   }
 
   public long getSearchIndex() {