Add the sync test cases

This commit is contained in:
luoyan35714 2014-12-12 18:10:31 +08:00
parent 630d186fae
commit 9051cd0168
20 changed files with 756 additions and 1665 deletions

View File

@ -0,0 +1,62 @@
1W-1
306
285
313
317
304
2W-1
854
894
806
852
797
4W-1
2213
2361
2239
2237
2188
5W-1
3093
3210
3168
3189
3191
8W-1
6840
6894
7319
6622
6726
9W-1
8358
8363
8256
8078
8052
10W-1
9317
9374
9371
9521
9273
15W-1
19537
19445
19683
19779
19839
20W-1
32322
32331
31646
37000
32886

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,64 @@
4W-2
1315
1375
1366
1264
1299
5W-2
1539
1713
1735
1762
1867
8W-2
3205
2718
3319
3315
2897
9W-2
3981
3516
4104
3472
4082
10W-2
5236
4278
5144
4075
4693
15W-2
8115
9879
9307
9808
8480
20W-2
13455
14925
15643
15901
15892
25W-2
30W-2
35W-2
40W-2

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,48 @@
8W-3
2014-12-12 16:07:04,800-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80001] Asynch read total used[2599] s
2014-12-12 16:07:54,110-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80001] Asynch read total used[2381] s
2014-12-12 16:08:12,253-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80001] Asynch read total used[2625] s
2014-12-12 16:08:30,710-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80001] Asynch read total used[2310] s
2014-12-12 16:09:02,352-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80001] Asynch read total used[2331] s
9W-3
2014-12-12 16:09:41,944-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2972] s
2014-12-12 16:10:02,465-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[3371] s
2014-12-12 16:10:23,425-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[3435] s
2014-12-12 16:10:44,557-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[3245] s
2014-12-12 16:11:05,036-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[3023] s
10W-3
2014-12-12 16:11:53,898-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100002] Asynch read total used[4187] s
2014-12-12 16:12:16,078-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100002] Asynch read total used[3129] s
2014-12-12 16:12:39,238-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100002] Asynch read total used[3547] s
2014-12-12 16:13:03,744-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100002] Asynch read total used[3678] s
2014-12-12 16:13:26,430-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100002] Asynch read total used[3161] s
15W-3
2014-12-12 16:14:28,781-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5265] s
2014-12-12 16:15:03,550-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[6081] s
2014-12-12 16:15:37,502-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5865] s
2014-12-12 16:16:13,128-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[7266] s
2014-12-12 16:16:49,886-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[7080] s
20W-3
2014-12-12 16:18:15,819-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200001] Asynch read total used[12524] s
2014-12-12 16:19:07,029-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200001] Asynch read total used[13811] s
2014-12-12 16:19:58,526-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200001] Asynch read total used[11569] s
2014-12-12 16:22:06,664-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200001] Asynch read total used[13724] s
2014-12-12 16:23:00,958-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200001] Asynch read total used[11061] s
25W-3
2014-12-12 16:25:25,795-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250002] Asynch read total used[24443] s
2014-12-12 16:27:01,758-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250002] Asynch read total used[37574] s
2014-12-12 16:31:06,212-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250002] Asynch read total used[23071] s
2014-12-12 16:32:22,591-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250002] Asynch read total used[25557] s
2014-12-12 16:35:33,209-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250002] Asynch read total used[29622] s
30W-3
35W-3
40W-3

View File

@ -0,0 +1,49 @@
8W-4
2014-12-12 16:48:10,928-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2153] s
2014-12-12 16:48:28,555-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2224] s
2014-12-12 16:48:44,819-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2263] s
2014-12-12 16:49:00,953-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2434] s
2014-12-12 16:49:17,579-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2560] s
2014-12-12 16:49:34,628-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2472] s
9W-4
2014-12-12 16:49:54,775-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2863] s
2014-12-12 16:50:15,708-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2946] s
2014-12-12 16:50:34,225-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2585] s
2014-12-12 16:50:53,483-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2934] s
2014-12-12 16:51:12,932-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2657] s
10W-4
2014-12-12 16:51:34,869-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3419] s
2014-12-12 16:51:58,115-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3383] s
2014-12-12 16:52:19,983-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3196] s
2014-12-12 16:52:40,819-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3539] s
2014-12-12 16:53:01,175-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3129] s
15W-4
2014-12-12 16:53:41,569-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5364] s
2014-12-12 16:54:13,094-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5146] s
2014-12-12 16:54:43,702-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5020] s
2014-12-12 16:55:14,548-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5132] s
2014-12-12 16:55:44,479-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[6131] s
20W-4
2014-12-12 16:57:41,862-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[7796] s
2014-12-12 16:58:24,701-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[10995] s
2014-12-12 16:59:06,698-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[9070] s
2014-12-12 16:59:58,312-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[7972] s
2014-12-12 17:00:41,751-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[9651] s
25W-4
2014-12-12 17:02:39,194-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[17530] s
2014-12-12 17:04:39,870-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[19312] s
2014-12-12 17:05:44,555-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[22256] s
2014-12-12 17:06:39,919-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[12621] s
2014-12-12 17:07:45,284-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[12087] s
30W-4
35W-4
40W-4

View File

@ -0,0 +1,44 @@
8W-5
2014-12-12 17:21:06,696-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2201] s
2014-12-12 17:21:23,617-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2477] s
2014-12-12 17:21:39,716-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2329] s
2014-12-12 17:21:56,319-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2246] s
2014-12-12 17:22:31,163-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [80000] Asynch read total used[2131] s
9W-5
2014-12-12 17:24:11,186-[TS] INFO Thread-4 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2663] s
2014-12-12 17:24:41,157-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2539] s
2014-12-12 17:25:02,432-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2723] s
2014-12-12 17:25:20,082-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2369] s
2014-12-12 17:25:49,246-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [90000] Asynch read total used[2795] s
10W-5
2014-12-12 17:26:27,426-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[2904] s
2014-12-12 17:26:50,406-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[2956] s
2014-12-12 17:27:10,580-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3052] s
2014-12-12 17:27:31,593-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3185] s
2014-12-12 17:27:51,833-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [100000] Asynch read total used[3156] s
15W-5
2014-12-12 17:28:21,874-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5117] s
2014-12-12 17:28:52,234-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[4468] s
2014-12-12 17:29:25,438-[TS] INFO Thread-4 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[4694] s
2014-12-12 17:29:56,752-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5240] s
2014-12-12 17:30:39,666-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [150000] Asynch read total used[5103] s
20W-5
2014-12-12 17:31:21,195-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[7330] s
2014-12-12 17:32:01,956-[TS] INFO Thread-4 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[8038] s
2014-12-12 17:32:45,593-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[9228] s
2014-12-12 17:33:39,330-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[9490] s
2014-12-12 17:34:21,467-[TS] INFO Thread-1 com.freud.opc.utgard.perf.SyncMultiThreadTest - [200000] Asynch read total used[7731] s
25W-5
2014-12-12 17:35:22,447-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[21186] s
2014-12-12 17:36:24,008-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[19787] s
2014-12-12 17:38:40,654-[TS] INFO Thread-0 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[11588] s
2014-12-12 17:40:07,884-[TS] INFO Thread-3 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[12010] s
2014-12-12 17:42:34,753-[TS] INFO Thread-2 com.freud.opc.utgard.perf.SyncMultiThreadTest - [250000] Asynch read total used[32604] s

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -0,0 +1,18 @@
8W-4
9W-4
10W-4
15W-4
20W-4
25W-4
30W-4
25W-4
40W-4

View File

@ -2,8 +2,6 @@ package com.freud.opc.utgard.perf;
import static com.freud.opc.utgard.perf.config.ConfigReader.config; import static com.freud.opc.utgard.perf.config.ConfigReader.config;
import java.util.Date;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.openscada.opc.lib.da.Group; import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item; import org.openscada.opc.lib.da.Item;
@ -19,15 +17,17 @@ public class SyncMultiThreadTest {
public synchronized static void end(long in) { public synchronized static void end(long in) {
end = in; end = in;
LOGGER.info("Asynch read total used[" + (end - start) + "] s"); LOGGER.info("[" + (count * TestMultiple.NUMBER)
+ "] Asynch read total used[" + (end - start) + "] s");
} }
private static long start; private static long start;
private static long end; private static long end;
private static final int count = 100; private static final int count = 6;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
LOGGER.info("----------------------");
for (int i = 1; i <= count; i++) { for (int i = 1; i <= count; i++) {
new Thread(new TestMultiple(i)).start(); new Thread(new TestMultiple(i)).start();
} }
@ -38,7 +38,7 @@ class TestMultiple implements Runnable {
private static Logger LOGGER = Logger.getLogger(TestMultiple.class); private static Logger LOGGER = Logger.getLogger(TestMultiple.class);
private static final int NUMBER = 4000; public static final int NUMBER = 25000;
private int count_number; private int count_number;
@ -60,21 +60,21 @@ class TestMultiple implements Runnable {
int limit = count_number * NUMBER; int limit = count_number * NUMBER;
LOGGER.info("[" + limit + ":]" + "Step-" + limit + ":"); // LOGGER.info("[" + limit + ":]" + "Step-" + limit + ":");
LOGGER.info("[" + limit + ":]" + "startDate[" + new Date() // LOGGER.info("[" + limit + ":]" + "startDate[" + new Date()
+ "],CurrentMillis:" + start); // + "],CurrentMillis:" + start);
Server server = new Server(config(), null); Server server = new Server(config(), null);
server.connect(); server.connect();
Group group = server.addGroup(); Group group = server.addGroup(count_number + "");
Item[] items = new Item[NUMBER]; Item[] items = new Item[NUMBER];
long createStart = System.currentTimeMillis(); long createStart = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Create the items[" + new Date() // LOGGER.info("[" + limit + "W:]" + "Create the items[" + new Date()
+ "],CurrentMillis:" + createStart); // + "],CurrentMillis:" + createStart);
for (int i = (count_number - 1) * NUMBER; i < limit; i++) { for (int i = (count_number - 1) * NUMBER; i < limit; i++) {
Item item = group.addItem("Random.Real" + i); Item item = group.addItem("Random.Real" + i);
@ -82,12 +82,12 @@ class TestMultiple implements Runnable {
} }
long createEnd = System.currentTimeMillis(); long createEnd = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Create finish [" + new Date() // LOGGER.info("[" + limit + "W:]" + "Create finish [" + new Date()
+ "],CurrentMillis:" + createEnd); // + "],CurrentMillis:" + createEnd);
long read = System.currentTimeMillis(); long read = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Start Read[" + new Date() // LOGGER.info("[" + limit + "W:]" + "Start Read[" + new Date()
+ "],CurrentMillis:" + read); // + "],CurrentMillis:" + read);
SyncMultiThreadTest.start(read); SyncMultiThreadTest.start(read);
group.read(true, items); group.read(true, items);
@ -99,6 +99,7 @@ class TestMultiple implements Runnable {
// + "Total[{0}], CreateItem[{1}], Read[{2}]", end - start, // + "Total[{0}], CreateItem[{1}], Read[{2}]", end - start,
// createEnd - createStart, end - read)); // createEnd - createStart, end - read));
group.clear();
group.remove(); group.remove();
server.dispose(); server.dispose();
} }

View File

@ -0,0 +1,109 @@
package com.freud.opc.utgard.perf;
import static com.freud.opc.utgard.perf.config.ConfigReader.config;
import java.util.Date;
import org.apache.log4j.Logger;
import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.Server;
public class SyncMultiThreadTest2 {
private static Logger LOGGER = Logger.getLogger(SyncMultiThreadTest2.class);
private static long[] start = new long[10];
private static long[] end = new long[10];
public synchronized static void start(int time, long in) {
if (start[time] == 0)
start[time] = in;
}
public synchronized static void end(int time, long in) {
end[time] = in;
LOGGER.info(time + "-Asynch read total used["
+ (end[time] - start[time]) + "] s");
}
private static final int count = 1;
public static void main(String[] args) throws Exception {
for (int time = 1; time <= 10; time++) {
for (int i = 1; i <= count; i++) {
new Thread(new TestMultiple2(time, i)).start();
}
}
}
}
class TestMultiple2 implements Runnable {
private static Logger LOGGER = Logger.getLogger(TestMultiple2.class);
private static final int NUMBER = 2 * 10000;
private int time;
private int count_number;
public TestMultiple2(int time, int count_number) {
this.time = time;
this.count_number = count_number;
}
public void run() {
try {
testSteps();
} catch (Exception e) {
e.printStackTrace();
}
}
private void testSteps() throws Exception {
long start = System.currentTimeMillis();
int limit = count_number * NUMBER;
LOGGER.info("[" + limit + ":]" + "Step-" + limit + ":");
LOGGER.info("[" + limit + ":]" + "startDate[" + new Date()
+ "],CurrentMillis:" + start);
Server server = new Server(config(), null);
server.connect();
Group group = server.addGroup();
Item[] items = new Item[NUMBER];
long createStart = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Create the items[" + new Date()
+ "],CurrentMillis:" + createStart);
for (int i = (count_number - 1) * NUMBER; i < limit; i++) {
Item item = group.addItem("Random.Real" + i);
items[i % NUMBER] = item;
}
long createEnd = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Create finish [" + new Date()
+ "],CurrentMillis:" + createEnd);
long read = System.currentTimeMillis();
LOGGER.info("[" + limit + "W:]" + "Start Read[" + new Date()
+ "],CurrentMillis:" + read);
SyncMultiThreadTest2.start(time, read);
group.read(true, items);
long end = System.currentTimeMillis();
// LOGGER.info("[" + limit + "W:]" + "End Read[" + new Date()
// + "],CurrentMillis:" + end);
SyncMultiThreadTest2.end(time, end);
// LOGGER.info(MessageFormat.format("[" + limit + "W:]"
// + "Total[{0}], CreateItem[{1}], Read[{2}]", end - start,
// createEnd - createStart, end - read));
group.remove();
server.dispose();
}
}

View File

@ -0,0 +1,75 @@
package com.freud.opc.utgard.perf.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class CountAverageNumber {
private static int i = 5;
public static void main(String[] args) throws Exception {
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
StringBuilder fileName = new StringBuilder("result/result_count_" + i
+ ".txt");
InputStream is = new FileInputStream(new File(fileName.toString()));
Reader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
int index = 0;
int tmp = 0;
List<Integer> list = null;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.contains("W-")) {
tmp = Integer.valueOf(line.split("-")[0].replace("W", "")
.replace("w", ""));
if (tmp != index) {
if (list != null) {
map.put(index, list);
}
index = tmp;
list = new ArrayList<Integer>();
}
} else {
if (line != null && !line.isEmpty())
list.add(Integer.valueOf(line.trim().split(
"Asynch read total used")[1].replace("] s", "")
.replace("[", "")));
}
}
map.put(index, list);
for (Entry<Integer, List<Integer>> entry : map.entrySet()) {
if (entry.getValue().size() > 0) {
int total = 0;
for (int item : entry.getValue()) {
total += item;
}
System.out.println(entry.getKey() + "w-average["
+ (total / entry.getValue().size()) + "ms]");
}
}
if (is != null) {
is.close();
}
if (isr != null) {
isr.close();
}
if (br != null) {
br.close();
}
}
}

View File

@ -0,0 +1,36 @@
package com.freud.opc.utgard.perf.util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class FileWriterUtil {
private static File file;
private static FileOutputStream fos;
private static BufferedWriter bw;
public static void init(String fileName) throws FileNotFoundException {
file = new File(fileName);
fos = new FileOutputStream(file, true);
bw = new BufferedWriter(new OutputStreamWriter(fos));
}
public static void write(String content) throws IOException {
bw.write(content + "\r\n");
}
public static void finish() throws IOException {
if (fos != null) {
fos.close();
}
if (bw != null) {
bw.close();
}
}
}

File diff suppressed because it is too large Load Diff