mirror of
https://github.com/luoyan35714/OPC_Client.git
synced 2025-02-26 20:47:42 +08:00
Change the Perf async test
This commit is contained in:
parent
f47887aab4
commit
fd77b8e66e
@ -1,3 +1 @@
|
|||||||
2014-12-04 11:46:45,336 INFO org.openscada.opc.lib.da.Server.connect:109 - Socket timeout: 0
|
2014-12-09 09:49:21,205 INFO com.freud.dcom.utgard.cases.DCOMTest5.main:67 - test
|
||||||
2014-12-04 11:46:47,516 INFO org.openscada.opc.lib.da.Server.cleanup:160 - Destroying DCOM session...
|
|
||||||
2014-12-04 11:46:47,518 INFO org.openscada.opc.lib.da.Server.cleanup:187 - Destroying DCOM session... forked
|
|
||||||
|
@ -17,8 +17,8 @@ import org.openscada.opc.dcom.da.OPCSERVERSTATUS;
|
|||||||
import org.openscada.opc.dcom.da.impl.OPCServer;
|
import org.openscada.opc.dcom.da.impl.OPCServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Server的Status信息
|
* 获取Server的Status信息 中文
|
||||||
* 中文
|
*
|
||||||
* @author Freud
|
* @author Freud
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -39,6 +39,7 @@ public class DCOMTest1 {
|
|||||||
final IJIComObject serverObject = comServer.createInstance();
|
final IJIComObject serverObject = comServer.createInstance();
|
||||||
|
|
||||||
OPCServer server = new OPCServer(serverObject);
|
OPCServer server = new OPCServer(serverObject);
|
||||||
|
|
||||||
dumpServerStatus(server);
|
dumpServerStatus(server);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@ import static com.freud.opc.utgard.BaseConfiguration.CONFIG_PASSWORD;
|
|||||||
import static com.freud.opc.utgard.BaseConfiguration.CONFIG_USERNAME;
|
import static com.freud.opc.utgard.BaseConfiguration.CONFIG_USERNAME;
|
||||||
import static com.freud.opc.utgard.BaseConfiguration.getEntryValue;
|
import static com.freud.opc.utgard.BaseConfiguration.getEntryValue;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jinterop.dcom.common.JIException;
|
import org.jinterop.dcom.common.JIException;
|
||||||
import org.jinterop.dcom.common.JISystem;
|
import org.jinterop.dcom.common.JISystem;
|
||||||
import org.jinterop.dcom.core.IJIComObject;
|
import org.jinterop.dcom.core.IJIComObject;
|
||||||
@ -54,7 +51,7 @@ public class DCOMTest6 {
|
|||||||
0.0f, 1033);
|
0.0f, 1033);
|
||||||
|
|
||||||
final OPCItemIO itemIO = server.getItemIOService();
|
final OPCItemIO itemIO = server.getItemIOService();
|
||||||
queryItems(itemIO, "Saw-toothed Waves.Int");
|
queryItems(itemIO, "Saw-toothed Waves.Int1");
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
server.removeGroup(group, true);
|
server.removeGroup(group, true);
|
||||||
@ -62,10 +59,12 @@ public class DCOMTest6 {
|
|||||||
|
|
||||||
public static void queryItems(final OPCItemIO itemIO, final String... items)
|
public static void queryItems(final OPCItemIO itemIO, final String... items)
|
||||||
throws JIException {
|
throws JIException {
|
||||||
final List<IORequest> requests = new LinkedList<IORequest>();
|
final IORequest[] requests = new IORequest[items.length];
|
||||||
for (final String item : items) {
|
|
||||||
requests.add(new IORequest(item, 0));
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
requests[i] = new IORequest(items[i], 0);
|
||||||
}
|
}
|
||||||
itemIO.read(requests.toArray(new IORequest[0]));
|
|
||||||
|
itemIO.read(requests);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,16 +66,16 @@ public class DCOMTest7 {
|
|||||||
OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,
|
OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,
|
||||||
0.0f, 1033);
|
0.0f, 1033);
|
||||||
|
|
||||||
testItems(server, group, new String[] { "Saw-toothed Waves.Int2" });
|
testItems(group, new String[] { "Saw-toothed Waves.Int2" });
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
server.removeGroup(group, true);
|
server.removeGroup(group, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void testItems(final OPCServer server,
|
public static void testItems(final OPCGroupStateMgt group,
|
||||||
final OPCGroupStateMgt group, final String... itemIDs)
|
final String... itemIDs) throws IllegalArgumentException,
|
||||||
throws IllegalArgumentException, UnknownHostException, JIException {
|
UnknownHostException, JIException {
|
||||||
final OPCItemMgt itemManagement = group.getItemManagement();
|
final OPCItemMgt itemManagement = group.getItemManagement();
|
||||||
final List<OPCITEMDEF> items = new ArrayList<OPCITEMDEF>(itemIDs.length);
|
final List<OPCITEMDEF> items = new ArrayList<OPCITEMDEF>(itemIDs.length);
|
||||||
for (final String id : itemIDs) {
|
for (final String id : itemIDs) {
|
||||||
|
@ -55,6 +55,5 @@ public class DumpDataCallback implements IOPCDataCallback {
|
|||||||
public void writeComplete(final int transactionId,
|
public void writeComplete(final int transactionId,
|
||||||
final int serverGroupHandle, final int masterErrorCode,
|
final int serverGroupHandle, final int masterErrorCode,
|
||||||
final ResultSet<Integer> result) {
|
final ResultSet<Integer> result) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import org.openscada.opc.lib.list.Category;
|
|||||||
import org.openscada.opc.lib.list.ServerList;
|
import org.openscada.opc.lib.list.ServerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得Server上所有的OPC连接信息
|
* Get all the opc connection info from Server
|
||||||
*
|
*
|
||||||
* @author Freud
|
* @author Freud
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ public class OPCTest1 {
|
|||||||
getEntryValue(CONFIG_USERNAME), getEntryValue(CONFIG_PASSWORD),
|
getEntryValue(CONFIG_USERNAME), getEntryValue(CONFIG_PASSWORD),
|
||||||
getEntryValue(CONFIG_DOMAIN));
|
getEntryValue(CONFIG_DOMAIN));
|
||||||
|
|
||||||
/** 通过ProgId获得ClsId,然后获得ClassDetail */
|
/** According the progid get the clsid, then get the classdetail */
|
||||||
// final String cls = serverList
|
// final String cls = serverList
|
||||||
// .getClsIdFromProgId("Matrikon.OPC.Simulation.1");
|
// .getClsIdFromProgId("Matrikon.OPC.Simulation.1");
|
||||||
//
|
//
|
||||||
|
@ -12,7 +12,9 @@ import org.openscada.opc.lib.da.browser.Leaf;
|
|||||||
import com.freud.opc.utgard.BaseConfiguration;
|
import com.freud.opc.utgard.BaseConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ClsId定位到连接,并将连接下的所有Group和Item打印
|
*
|
||||||
|
* According the clsid get the connection and print all the group and item
|
||||||
|
* information
|
||||||
*
|
*
|
||||||
* @author Freud
|
* @author Freud
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
package com.freud.opc.dcom.perf;
|
||||||
|
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.CLSID;
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.DOMAIN;
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.HOST;
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.PASSWORD;
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.USERNAME;
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.getProp;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.jinterop.dcom.common.JISystem;
|
||||||
|
import org.jinterop.dcom.core.IJIComObject;
|
||||||
|
import org.jinterop.dcom.core.JIClsid;
|
||||||
|
import org.jinterop.dcom.core.JIComServer;
|
||||||
|
import org.jinterop.dcom.core.JISession;
|
||||||
|
import org.openscada.opc.dcom.common.KeyedResult;
|
||||||
|
import org.openscada.opc.dcom.common.KeyedResultSet;
|
||||||
|
import org.openscada.opc.dcom.common.ResultSet;
|
||||||
|
import org.openscada.opc.dcom.da.IOPCDataCallback;
|
||||||
|
import org.openscada.opc.dcom.da.OPCITEMDEF;
|
||||||
|
import org.openscada.opc.dcom.da.OPCITEMRESULT;
|
||||||
|
import org.openscada.opc.dcom.da.ValueData;
|
||||||
|
import org.openscada.opc.dcom.da.impl.OPCGroupStateMgt;
|
||||||
|
import org.openscada.opc.dcom.da.impl.OPCServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Freud
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SyncPerfTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
JISystem.setAutoRegisteration(true);
|
||||||
|
|
||||||
|
JISession session = JISession.createSession(getProp(DOMAIN),
|
||||||
|
getProp(USERNAME), getProp(PASSWORD));
|
||||||
|
|
||||||
|
final JIComServer comServer = new JIComServer(
|
||||||
|
JIClsid.valueOf(getProp(CLSID)), getProp(HOST), session);
|
||||||
|
|
||||||
|
final IJIComObject serverObject = comServer.createInstance();
|
||||||
|
|
||||||
|
OPCServer server = new OPCServer(serverObject);
|
||||||
|
|
||||||
|
OPCGroupStateMgt group = server.addGroup("", true, 1000, 1234, 0, 0.0f,
|
||||||
|
1033);
|
||||||
|
|
||||||
|
//group.getSyncIO().read(source, serverHandles)
|
||||||
|
|
||||||
|
OPCITEMDEF item = new OPCITEMDEF();
|
||||||
|
|
||||||
|
item.setActive(true);
|
||||||
|
item.setItemID("Random.real10");
|
||||||
|
item.setClientHandle(new Random().nextInt());
|
||||||
|
|
||||||
|
group.attach(new IOPCDataCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeComplete(int arg0, int arg1, int arg2,
|
||||||
|
ResultSet<Integer> arg3) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readComplete(int arg0, int arg1, int arg2, int arg3,
|
||||||
|
KeyedResultSet<Integer, ValueData> arg4) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dataChange(int arg0, int arg1, int arg2, int arg3,
|
||||||
|
KeyedResultSet<Integer, ValueData> items) {
|
||||||
|
for (KeyedResult<Integer, ValueData> item : items) {
|
||||||
|
System.out.println(item.getKey() + "-------"
|
||||||
|
+ item.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelComplete(int arg0, int arg1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
KeyedResultSet<OPCITEMDEF, OPCITEMRESULT> test = group
|
||||||
|
.getItemManagement().add(item);
|
||||||
|
|
||||||
|
System.out.println(test.size());
|
||||||
|
|
||||||
|
Thread.sleep(10 * 1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -3,14 +3,20 @@ 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 java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.openscada.opc.lib.da.AccessBase;
|
import org.openscada.opc.dcom.common.KeyedResult;
|
||||||
|
import org.openscada.opc.dcom.common.KeyedResultSet;
|
||||||
|
import org.openscada.opc.dcom.common.ResultSet;
|
||||||
|
import org.openscada.opc.dcom.da.IOPCDataCallback;
|
||||||
|
import org.openscada.opc.dcom.da.OPCDATASOURCE;
|
||||||
|
import org.openscada.opc.dcom.da.ValueData;
|
||||||
|
import org.openscada.opc.dcom.da.impl.OPCAsyncIO2;
|
||||||
|
import org.openscada.opc.lib.common.NotConnectedException;
|
||||||
|
import org.openscada.opc.lib.da.Group;
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
import org.openscada.opc.lib.da.SyncAccess;
|
|
||||||
|
|
||||||
import com.freud.opc.utgard.perf.common.DataCallBackListener;
|
|
||||||
|
|
||||||
public class AsyncOPCPerfTest {
|
public class AsyncOPCPerfTest {
|
||||||
|
|
||||||
@ -32,17 +38,62 @@ public class AsyncOPCPerfTest {
|
|||||||
|
|
||||||
server.connect();
|
server.connect();
|
||||||
|
|
||||||
AccessBase access = new SyncAccess(server, 1000);
|
Group group = server.addGroup("Freud");
|
||||||
int limit = count * NUMBER;
|
// AsyncResult result = group.getAsyncIO20().read(transactionId,
|
||||||
for (int i = 0; i < limit; i++) {
|
// serverHandles);
|
||||||
access.addItem("Random.Real" + i, new DataCallBackListener(limit));
|
|
||||||
|
group.addItem("Read Error.Int1");
|
||||||
|
group.addItem("Random.Int1");
|
||||||
|
|
||||||
|
OPCAsyncIO2 async20 = group.getAsyncIO20();
|
||||||
|
|
||||||
|
if (async20 == null)
|
||||||
|
throw new NotConnectedException();
|
||||||
|
async20.refresh(OPCDATASOURCE.OPC_DS_DEVICE, 0);
|
||||||
|
|
||||||
|
group.attach(new IOPCDataCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeComplete(int arg0, int arg1, int arg2,
|
||||||
|
ResultSet<Integer> arg3) {
|
||||||
|
System.out.println("Write Complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
access.bind();
|
@Override
|
||||||
Thread.sleep(5000);
|
public void readComplete(int arg0, int arg1, int arg2, int arg3,
|
||||||
access.unbind();
|
KeyedResultSet<Integer, ValueData> arg4) {
|
||||||
|
System.out.println("Read Complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dataChange(int arg0, int arg1, int arg2, int arg3,
|
||||||
|
KeyedResultSet<Integer, ValueData> arg4) {
|
||||||
|
Iterator<KeyedResult<Integer, ValueData>> ite = arg4.iterator();
|
||||||
|
int i = 0;
|
||||||
|
while (ite.hasNext()) {
|
||||||
|
KeyedResult<Integer, ValueData> value = ite.next();
|
||||||
|
System.out.println((++i) + "-" + value.getKey() + "--"
|
||||||
|
+ value.getValue().getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelComplete(int arg0, int arg1) {
|
||||||
|
System.out.println("Cancel Complete");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// AccessBase access = new SyncAccess(server, 1000);
|
||||||
|
//
|
||||||
|
// int limit = count * NUMBER;
|
||||||
|
// for (int i = 0; i < limit; i++) {
|
||||||
|
// access.addItem("Random.Real" + i, new DataCallBackListener(limit));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// access.bind();
|
||||||
|
Thread.sleep(100000);
|
||||||
|
// access.unbind();
|
||||||
|
|
||||||
server.dispose();
|
server.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,25 @@ 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 java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.openscada.opc.lib.da.AccessBase;
|
import org.openscada.opc.dcom.common.KeyedResultSet;
|
||||||
|
import org.openscada.opc.dcom.common.ResultSet;
|
||||||
|
import org.openscada.opc.dcom.da.IOPCDataCallback;
|
||||||
|
import org.openscada.opc.dcom.da.ValueData;
|
||||||
import org.openscada.opc.lib.da.Async20Access;
|
import org.openscada.opc.lib.da.Async20Access;
|
||||||
import org.openscada.opc.lib.da.AutoReconnectController;
|
import org.openscada.opc.lib.da.Group;
|
||||||
import org.openscada.opc.lib.da.DataCallback;
|
|
||||||
import org.openscada.opc.lib.da.Item;
|
import org.openscada.opc.lib.da.Item;
|
||||||
import org.openscada.opc.lib.da.ItemState;
|
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
|
||||||
public class PublishOPCPerfTest {
|
public class PublishOPCPerfTest {
|
||||||
|
|
||||||
private static Logger LOGGER = Logger.getLogger(PublishOPCPerfTest.class);
|
private static Logger LOGGER = Logger.getLogger(PublishOPCPerfTest.class);
|
||||||
|
|
||||||
private static final int NUMBER = 10;
|
private static final int NUMBER = 10000;
|
||||||
private static final int WAN_NUMBER = 10;
|
private static final int WAN_NUMBER = 1;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
for (int i = 1; i <= WAN_NUMBER; i++) {
|
for (int i = 1; i <= WAN_NUMBER; i++) {
|
||||||
@ -35,26 +37,36 @@ public class PublishOPCPerfTest {
|
|||||||
|
|
||||||
Server server = new Server(config(),
|
Server server = new Server(config(),
|
||||||
Executors.newSingleThreadScheduledExecutor());
|
Executors.newSingleThreadScheduledExecutor());
|
||||||
AutoReconnectController controller = new AutoReconnectController(server);
|
|
||||||
|
|
||||||
controller.connect();
|
server.connect();
|
||||||
|
|
||||||
AccessBase access = new Async20Access(server, 1000, true);
|
Group group = server.addGroup("Group");
|
||||||
|
|
||||||
|
Map<String, Item> map = group.addItems("Random.int" + 1);
|
||||||
|
|
||||||
|
group.attach(new IOPCDataCallback() {
|
||||||
|
|
||||||
int limit = count * NUMBER;
|
|
||||||
for (int i = 0; i < limit; i++) {
|
|
||||||
access.addItem("Random.Real" + i, new DataCallback() {
|
|
||||||
@Override
|
@Override
|
||||||
public void changed(Item item, ItemState is) {
|
public void writeComplete(int i, int j, int k,
|
||||||
LOGGER.info("Item:[" + item.getId() + "], Value:["
|
ResultSet<Integer> resultset) {
|
||||||
+ is.getValue() + "]");
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readComplete(int i, int j, int k, int l,
|
||||||
|
KeyedResultSet<Integer, ValueData> keyedresultset) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dataChange(int i, int j, int k, int l,
|
||||||
|
KeyedResultSet<Integer, ValueData> keyedresultset) {
|
||||||
|
System.out.println("DataChanged");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelComplete(int i, int j) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
access.bind();
|
|
||||||
Thread.sleep(2 * 24 * 60 * 60 * 1000);
|
|
||||||
access.unbind();
|
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
LOGGER.info("EndDate[" + new Date() + "],CurrentMillis:" + end);
|
LOGGER.info("EndDate[" + new Date() + "],CurrentMillis:" + end);
|
||||||
LOGGER.info("Total Spend:[" + (end - start) + "]");
|
LOGGER.info("Total Spend:[" + (end - start) + "]");
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.freud.opc.utgard.perf;
|
||||||
|
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.config;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
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 SyncMultiThreadTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
for (int i = 1; i <= 20; i++) {
|
||||||
|
new Thread(new TestMultiple(i)).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestMultiple implements Runnable {
|
||||||
|
|
||||||
|
private static Logger LOGGER = Logger.getLogger(TestMultiple.class);
|
||||||
|
|
||||||
|
private static final int NUMBER = 20000;
|
||||||
|
|
||||||
|
private int count_number;
|
||||||
|
|
||||||
|
public TestMultiple(int count_number) {
|
||||||
|
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 + "W:]" + "Step-" + limit + "W:");
|
||||||
|
LOGGER.info("[" + limit + "W:]" + "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);
|
||||||
|
|
||||||
|
group.read(true, items);
|
||||||
|
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
LOGGER.info("[" + limit + "W:]" + "End Read[" + new Date()
|
||||||
|
+ "],CurrentMillis:" + end);
|
||||||
|
|
||||||
|
LOGGER.info(MessageFormat.format("[" + limit + "W:]"
|
||||||
|
+ "Total[{0}], CreateItem[{1}], Read[{2}]", end - start,
|
||||||
|
createEnd - createStart, end - read));
|
||||||
|
|
||||||
|
group.remove();
|
||||||
|
server.dispose();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.freud.opc.utgard.perf;
|
||||||
|
|
||||||
|
import static com.freud.opc.utgard.perf.config.ConfigReader.config;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.openscada.opc.dcom.common.KeyedResultSet;
|
||||||
|
import org.openscada.opc.dcom.common.ResultSet;
|
||||||
|
import org.openscada.opc.dcom.da.IOPCDataCallback;
|
||||||
|
import org.openscada.opc.dcom.da.ValueData;
|
||||||
|
import org.openscada.opc.lib.da.Group;
|
||||||
|
import org.openscada.opc.lib.da.Item;
|
||||||
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
private static Logger LOGGER = Logger.getLogger(Test.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
LOGGER.info("Step-" + 10 + "W:");
|
||||||
|
LOGGER.info("StartDate[" + new Date() + "],CurrentMillis:" + start);
|
||||||
|
|
||||||
|
Server server = new Server(config(),
|
||||||
|
Executors.newSingleThreadScheduledExecutor());
|
||||||
|
|
||||||
|
server.connect();
|
||||||
|
|
||||||
|
Group group = server.addGroup();
|
||||||
|
Item item = group.addItem("Random.int4");
|
||||||
|
|
||||||
|
group.setActive(true);
|
||||||
|
group.setActive(true, item);
|
||||||
|
|
||||||
|
group.attach(new IOPCDataCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeComplete(int i, int j, int k,
|
||||||
|
ResultSet<Integer> resultset) {
|
||||||
|
System.out.println("Write Complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readComplete(int i, int j, int k, int l,
|
||||||
|
KeyedResultSet<Integer, ValueData> keyedresultset) {
|
||||||
|
System.out.println("Read Complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dataChange(int i, int j, int k, int l,
|
||||||
|
KeyedResultSet<Integer, ValueData> keyedresultset) {
|
||||||
|
System.out.println("Data change");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelComplete(int i, int j) {
|
||||||
|
System.out.println("Cancel Complete");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Thread.sleep(10 * 1000);
|
||||||
|
|
||||||
|
server.disconnect();
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
1631
OPC_Client_Utgard_Performance/utgard_result.log.2014-12-05
Normal file
1631
OPC_Client_Utgard_Performance/utgard_result.log.2014-12-05
Normal file
File diff suppressed because it is too large
Load Diff
38
OPC_Client_Utgard_Performance/utgard_result.log.2014-12-08
Normal file
38
OPC_Client_Utgard_Performance/utgard_result.log.2014-12-08
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
2014-12-08 17:46:17,893-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:46:17,896-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:46:17 CST 2014],CurrentMillis:1418031977893
|
||||||
|
2014-12-08 17:47:03,585-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:47:03,587-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:47:03 CST 2014],CurrentMillis:1418032023584
|
||||||
|
2014-12-08 17:47:20,032-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:47:20,034-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:47:20 CST 2014],CurrentMillis:1418032040031
|
||||||
|
2014-12-08 17:49:16,331-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:49:16,333-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:49:16 CST 2014],CurrentMillis:1418032156330
|
||||||
|
2014-12-08 17:51:33,229-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:51:33,232-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:51:33 CST 2014],CurrentMillis:1418032293229
|
||||||
|
2014-12-08 17:52:05,824-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:52:05,827-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:52:05 CST 2014],CurrentMillis:1418032325823
|
||||||
|
2014-12-08 17:52:17,357-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:52:17,359-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:52:17 CST 2014],CurrentMillis:1418032337357
|
||||||
|
2014-12-08 17:52:59,674-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:52:59,679-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:52:59 CST 2014],CurrentMillis:1418032379674
|
||||||
|
2014-12-08 17:53:47,539-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:53:47,543-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:53:47 CST 2014],CurrentMillis:1418032427538
|
||||||
|
2014-12-08 17:55:53,542-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:55:53,545-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:55:53 CST 2014],CurrentMillis:1418032553542
|
||||||
|
2014-12-08 17:55:59,665-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:55:59,667-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:55:59 CST 2014],CurrentMillis:1418032559664
|
||||||
|
2014-12-08 17:56:14,868-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:56:14,870-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:56:14 CST 2014],CurrentMillis:1418032574867
|
||||||
|
2014-12-08 17:56:29,802-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 17:56:29,804-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 17:56:29 CST 2014],CurrentMillis:1418032589801
|
||||||
|
2014-12-08 18:02:27,344-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:02:27,346-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:02:27 CST 2014],CurrentMillis:1418032947343
|
||||||
|
2014-12-08 18:02:56,547-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:02:56,549-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:02:56 CST 2014],CurrentMillis:1418032976546
|
||||||
|
2014-12-08 18:03:11,042-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:03:11,045-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:03:11 CST 2014],CurrentMillis:1418032991042
|
||||||
|
2014-12-08 18:04:08,433-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:04:08,435-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:04:08 CST 2014],CurrentMillis:1418033048432
|
||||||
|
2014-12-08 18:04:43,469-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:04:43,472-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:04:43 CST 2014],CurrentMillis:1418033083469
|
||||||
|
2014-12-08 18:12:54,889-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - Step-1W:
|
||||||
|
2014-12-08 18:12:54,891-[TS] INFO main com.freud.opc.utgard.perf.AsyncOPCPerfTest - StartDate[Mon Dec 08 18:12:54 CST 2014],CurrentMillis:1418033574888
|
BIN
学习笔记/最优配置.xlsx
Normal file
BIN
学习笔记/最优配置.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user