Migrate to MD-SAL APIs
[controller.git] / opendaylight / md-sal / benchmark-data-store / src / main / java / org / opendaylight / controller / md / sal / dom / store / benchmark / InMemoryDataStoreWriteTransactionBenchmark.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.md.sal.dom.store.benchmark;
9
10 import java.util.concurrent.Executors;
11 import java.util.concurrent.TimeUnit;
12 import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
13 import org.openjdk.jmh.annotations.BenchmarkMode;
14 import org.openjdk.jmh.annotations.Fork;
15 import org.openjdk.jmh.annotations.Level;
16 import org.openjdk.jmh.annotations.Mode;
17 import org.openjdk.jmh.annotations.OutputTimeUnit;
18 import org.openjdk.jmh.annotations.Scope;
19 import org.openjdk.jmh.annotations.Setup;
20 import org.openjdk.jmh.annotations.State;
21 import org.openjdk.jmh.annotations.TearDown;
22
23 /**
24  * Benchmark for testing of performance of write operations for
25  * InMemoryDataStore. The instance of benchmark creates InMemoryDataStore with
26  * Data Change Listener Executor Service as Same Thread Executor and DOM Store
27  * Executor Service as Same Thread Executor.
28  *
29  * @author Lukas Sedlak
30  */
31 @State(Scope.Thread)
32 @BenchmarkMode(Mode.AverageTime)
33 @OutputTimeUnit(TimeUnit.MILLISECONDS)
34 @Fork(1)
35 public class InMemoryDataStoreWriteTransactionBenchmark extends AbstractInMemoryDatastoreWriteTransactionBenchmark {
36
37     @Override
38     @Setup(Level.Trial)
39     public void setUp() throws Exception {
40         domStore = new InMemoryDOMDataStore("SINGLE_THREADED_DS_BENCHMARK", Executors.newSingleThreadExecutor());
41         schemaContext = BenchmarkModel.createTestContext();
42         domStore.onGlobalContextUpdated(schemaContext);
43         initTestNode();
44     }
45
46     @Override
47     @TearDown
48     public void tearDown() {
49         schemaContext = null;
50         domStore = null;
51     }
52 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.