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 2023/04/18 09:39:08 UTC
[iotdb] branch guonengtest updated: random value to fix value
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch guonengtest
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/guonengtest by this push:
new 3efb5314dc random value to fix value
3efb5314dc is described below
commit 3efb5314dc5b7f51201db1ee4d4ccad5dcdf41f2
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Apr 18 17:38:57 2023 +0800
random value to fix value
---
.../session/src/main/java/org/apache/iotdb/WriterTest.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/example/session/src/main/java/org/apache/iotdb/WriterTest.java b/example/session/src/main/java/org/apache/iotdb/WriterTest.java
index 54d31a6545..a61a05740b 100644
--- a/example/session/src/main/java/org/apache/iotdb/WriterTest.java
+++ b/example/session/src/main/java/org/apache/iotdb/WriterTest.java
@@ -53,6 +53,8 @@ public class WriterTest {
private static AtomicInteger totalRowNumber = new AtomicInteger();
+ private static float[] floatData = new float[10000];
+
private static Random r;
/** Build a custom SessionPool for this example */
@@ -151,6 +153,12 @@ public class WriterTest {
types.add(TSDataType.FLOAT);
}
+ r = new Random();
+
+ for (int i = 0; i < floatData.length; i++) {
+ floatData[i] = r.nextFloat();
+ }
+
Thread[] threads = new Thread[THREAD_NUMBER];
SyncWriteSignal signal = new SyncWriteSignal(THREAD_NUMBER);
@@ -159,7 +167,6 @@ public class WriterTest {
}
// count total execution time
- r = new Random();
long startTime = System.currentTimeMillis();
Runtime.getRuntime()
.addShutdownHook(
@@ -207,7 +214,7 @@ public class WriterTest {
times.add(timestamp);
List<Object> values = new ArrayList<>();
for (int i = 0; i < SENSOR_NUMBER; i++) {
- values.add(r.nextFloat());
+ values.add(floatData[(int) ((i + j + timestamp) % floatData.length)]);
}
valuesList.add(values);
measurementsList.add(measurements);