You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/12/21 03:48:19 UTC
[iotdb] 04/04: add format code
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch QueryMetrics
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit d7c442b51630ce52a8afe7671ab73f13fe32ee8e
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed Dec 21 11:48:08 2022 +0800
add format code
---
.../java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java b/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
index 9488fce01c..be908bae34 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import javax.annotation.concurrent.ThreadSafe;
+import java.text.DecimalFormat;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
@@ -42,6 +43,8 @@ public class QueryStatistics {
private static final Logger QUERY_STATISTICS_LOGGER =
LoggerFactory.getLogger(IoTDBConstant.QUERY_STATISTICS_LOGGER_NAME);
+ private static final DecimalFormat format = new DecimalFormat("#,###");
+
private final AtomicBoolean tracing = new AtomicBoolean(false);
private final Map<String, OperationStatistic> operationStatistics = new ConcurrentHashMap<>();
@@ -406,12 +409,12 @@ public class QueryStatistics {
long count = totalCount.get();
return "{"
+ "totalTime="
- + time
+ + format.format(time)
+ "us"
+ ", totalCount="
- + count
+ + format.format(count)
+ ", avgOpTime="
- + (time / count)
+ + format.format(time / count)
+ "us"
+ '}';
}