X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fbenchmark-data-store%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fbenchmark%2FAbstractInMemoryBrokerWriteTransactionBenchmark.java;h=04298a66fe139e696b3ddbbff6c85cff67d7a35c;hp=fdd715e54f46aafa86004faa8ec23b8bc211aaf9;hb=a7fa4e6badc5d5d3f402bedb72edebbf5c12bd2b;hpb=6a4c3c11f68c52d00d2bc7f0b30b086113ebe859 diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java index fdd715e54f..04298a66fe 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,24 +8,27 @@ package org.opendaylight.controller.md.sal.dom.store.benchmark; import java.util.concurrent.TimeUnit; + import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; -import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl; +import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; /** - * @author Lukas Sedlak + * Abstract class to handle transaction benchmarks. + * + * @author Lukas Sedlak */ -public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryWriteTransactionBenchmark { +public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark + extends AbstractInMemoryWriteTransactionBenchmark { - protected DOMDataBrokerImpl domBroker; + protected SerializedDOMDataBroker domBroker; protected void initTestNode() throws Exception { - final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH) - .build(); + final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build(); DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); writeTx.put(LogicalDatastoreType.OPERATIONAL, testPath, provideOuterListNode()); @@ -39,7 +42,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], + OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); @@ -51,7 +55,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], + OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } @@ -63,7 +68,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], + OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); @@ -75,7 +81,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], + OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } } @@ -86,7 +93,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() throws Exception { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], + OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); } @@ -97,7 +105,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], + OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } }