@@ -0,0 +1,2494 @@
+/*%0A * Copyright (c) 2013-2015 Cinchapi, Inc.%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A * http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.cinchapi.concourse.perf;%0A%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport org.cinchapi.concourse.ConcourseIntegrationTest;%0Aimport org.junit.Test;%0A%0Aimport com.google.common.base.Stopwatch;%0A%0A/**%0A * %0A * %0A * @author Jeff Nelson%0A */%0Apublic class OpsPerSecondTest extends ConcourseIntegrationTest %7B%0A%0A    @Override%0A    public void beforeEachTest() %7B%0A        client.add(%22table = foo%22, 1);%0A        client.add(%22id%22, 1, 1);%0A        client.add(%22bar%22, 1, 1);%0A    %7D%0A%0A    @Test%0A    public void testSelectAll() %7B%0A        int count = 20000;%0A        Stopwatch watch = Stopwatch.createStarted();%0A        for (int i = 0; i %3C count; ++i) %7B%0A            client.select(%22table = foo%22);%0A        %7D%0A        watch.stop();%0A        long elapsed = watch.elapsed(TimeUnit.MILLISECONDS);%0A        double seconds = elapsed / 1000.0;%0A        double ops = count / seconds;%0A        System.out.println(%22Select all operations per second: %22 + ops);%0A    %7D%0A%0A    @Test%0A    public void testUpdate() %7B%0A        int count = 5000;%0A        Stopwatch watch = Stopwatch.createStarted();%0A        for (int i = 0; i %3C count; ++i) %7B%0A            client.set(%22bar%22, client.%3CInteger%3E get(%22bar%22, 1), 1);%0A        %7D%0A        watch.stop();%0A        long elapsed = watch.elapsed(TimeUnit.MILLISECONDS);%0A        double seconds = elapsed / 1000.0;%0A        double ops = count / seconds;%0A        System.out.println(%22Update operations per second: %22 + ops);%0A    %7D%0A%0A    @Test%0A    public void testVerifyAndSwap() %7B%0A        int count = 5000;%0A        Stopwatch watch = Stopwatch.createStarted();%0A        for (int i = 0; i %3C count; ++i) %7B%0A            client.verifyAndSwap(%22bar%22, i + 1, 1, i + 2);%0A        %7D%0A        watch.stop();%0A        long elapsed = watch.elapsed(TimeUnit.MILLISECONDS);%0A        double seconds = elapsed / 1000.0;%0A        double ops = count / seconds;%0A        System.out.println(%22Verify and swap operations per second: %22 + ops);%0A    %7D%0A%0A%7D%0A

add ops per second test