You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by li...@apache.org on 2019/06/04 12:04:19 UTC

[incubator-iotdb] branch zc_time_statistic created (now c8eb152)

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

liurui pushed a change to branch zc_time_statistic
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at c8eb152  add threshold for recording measurements

This branch includes the following new commits:

     new c8eb152  add threshold for recording measurements

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: add threshold for recording measurements

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liurui pushed a commit to branch zc_time_statistic
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit c8eb15281008ba860bacfd294a42079e7ecbfaac
Author: liuruiyiyang <24...@qq.com>
AuthorDate: Tue Jun 4 20:03:54 2019 +0800

    add threshold for recording measurements
---
 iotdb/iotdb/conf/iotdb-engine.properties                   |  2 ++
 .../main/java/org/apache/iotdb/db/conf/IoTDBConfig.java    | 14 ++++++++++++++
 .../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java     |  4 ++++
 .../java/org/apache/iotdb/db/cost/stastic/Measurement.java |  8 ++++++--
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/iotdb/iotdb/conf/iotdb-engine.properties b/iotdb/iotdb/conf/iotdb-engine.properties
index f97b542..4b4206d 100644
--- a/iotdb/iotdb/conf/iotdb-engine.properties
+++ b/iotdb/iotdb/conf/iotdb-engine.properties
@@ -225,3 +225,5 @@ update_historical_data_possibility=false
 enable_write_performance_stat=true
 # The interval of small flush in ms.
 performance_stat_display_interval=60000
+# The stat time cost (in nanosecond) which are less than performanceMeasureThreshold will not be measured.
+performance_measure_threshold=1000000000
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 178d517..583937c 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -292,6 +292,12 @@ public class IoTDBConfig {
    */
   private long performanceStatDisplayInterval = 60000;
 
+  /**
+   * The stat time cost (in nanosecond) which are less than performanceMeasureThreshold
+   * will not be measured.
+   */
+  private long performanceMeasureThreshold = 1000000000;
+
   public IoTDBConfig() {
     // empty constructor
   }
@@ -855,4 +861,12 @@ public class IoTDBConfig {
   public void setPerformanceStatDisplayInterval(long performanceStatDisplayInterval) {
     this.performanceStatDisplayInterval = performanceStatDisplayInterval;
   }
+
+  public long getPerformanceMeasureThreshold() {
+    return performanceMeasureThreshold;
+  }
+
+  public void setPerformanceMeasureThreshold(long performanceMeasureThreshold) {
+    this.performanceMeasureThreshold = performanceMeasureThreshold;
+  }
 }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 571012c..bf10a05 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -258,6 +258,10 @@ public class IoTDBDescriptor {
       conf.setPerformanceStatDisplayInterval(Long
           .parseLong(properties.getProperty("performance_stat_display_interval",
               Long.toString(conf.getPerformanceStatDisplayInterval())).trim()));
+
+      conf.setPerformanceMeasureThreshold(Long
+          .parseLong(properties.getProperty("performance_measure_threshold",
+              Long.toString(conf.getPerformanceMeasureThreshold())).trim()));
     } catch (IOException e) {
       LOGGER.warn("Cannot load config file because, use default configuration", e);
     } catch (Exception e) {
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/cost/stastic/Measurement.java b/iotdb/src/main/java/org/apache/iotdb/db/cost/stastic/Measurement.java
index fba0493..284abda 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/cost/stastic/Measurement.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/cost/stastic/Measurement.java
@@ -56,12 +56,13 @@ public class Measurement {
   private boolean isEnableStat;
   private long displayIntervalInMs;
   private static final Logger LOGGER = LoggerFactory.getLogger(Measurement.class);
-
+  private long threshold;
 
 
   private Measurement(){
     isEnableStat = IoTDBDescriptor.getInstance().getConfig().isEnableWritePerformanceStat();
     if (isEnableStat) {
+      threshold =  IoTDBDescriptor.getInstance().getConfig().getPerformanceMeasureThreshold();
       displayIntervalInMs = IoTDBDescriptor.getInstance().getConfig().getPerformanceStatDisplayInterval();
       operationLatenciesQueue = new ConcurrentLinkedQueue[Operation.values().length];
       operationLatencies = new long[Operation.values().length];
@@ -109,7 +110,10 @@ public class Measurement {
 
   public void addOperationLatency(Operation op, long startTime) {
     if (isEnableStat) {
-      operationLatenciesQueue[op.ordinal()].add((System.nanoTime() - startTime));
+      long a = System.nanoTime() - startTime;
+      if(a > threshold) {
+        operationLatenciesQueue[op.ordinal()].add(a);
+      }
     }
   }