當前位置: 首頁>>代碼示例>>Java>>正文


Java TearDown類代碼示例

本文整理匯總了Java中org.openjdk.jmh.annotations.TearDown的典型用法代碼示例。如果您正苦於以下問題:Java TearDown類的具體用法?Java TearDown怎麽用?Java TearDown使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TearDown類屬於org.openjdk.jmh.annotations包,在下文中一共展示了TearDown類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkHelpers

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
private void checkHelpers(MethodInfo mi, Class<? extends Annotation> annClass) {
    // OK to have these annotation for @State objects
    if (BenchmarkGeneratorUtils.getAnnSuper(mi.getDeclaringClass(), State.class) == null) {
        if (!mi.getDeclaringClass().isAbstract()) {
            throw new GenerationException(
                    "@" + TearDown.class.getSimpleName() + " annotation is placed within " +
                            "the class not having @" + State.class.getSimpleName() + " annotation. " +
                            "This has no behavioral effect, and prohibited.",
                    mi);
        }
    }

    if (!mi.isPublic()) {
        throw new GenerationException(
                "@" + annClass.getSimpleName() + " method should be public.",
                mi);
    }

    if (!mi.getReturnType().equalsIgnoreCase("void")) {
        throw new GenerationException(
                "@" + annClass.getSimpleName() + " method should not return anything.",
                mi);
    }
}
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:25,代碼來源:StateObjectHandler.java

示例2: tearDownLATEST

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Trial)
        public void tearDownLATEST() { // this name ensures this is the latest teardown to run
            Assert.assertEquals("Setup1 called once", 1, countSetupRun1.get());
            Assert.assertEquals("Setup2 called once", 1, countSetupRun2.get());
            Assert.assertEquals("Setup3 called twice", 2, countSetupIteration1.get());
            Assert.assertEquals("Setup4 called twice", 2, countSetupIteration2.get());

            // These asserts make no sense for Benchmark tests
//            Assert.assertEquals("Setup5 = invocation count", countInvocations.get(), countSetupInvocation1.get());
//            Assert.assertEquals("Setup6 = invocation count", countInvocations.get(), countSetupInvocation2.get());

            Assert.assertEquals("TearDown1 called once", 1, countTearDownRun1.get());
            Assert.assertEquals("TearDown2 called once", 1, countTearDownRun2.get());
            Assert.assertEquals("TearDown3 called twice", 2, countTearDownIteration1.get());
            Assert.assertEquals("TearDown4 called twice", 2, countTearDownIteration2.get());

            // These two asserts make no sense for Benchmark tests.
//            Assert.assertEquals("TearDown5 = invocation count", countInvocations.get(), countTearDownInvocation1.get());
//            Assert.assertEquals("TearDown6 = invocation count", countInvocations.get(), countTearDownInvocation2.get());
        }
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:21,代碼來源:BenchmarkStateHelperTimesTest.java

示例3: tearDownLATEST

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Trial)
    public void tearDownLATEST() { // this name ensures this is the latest teardown to run
        Assert.assertEquals("Setup1 called once", 1, countSetupRun1.get());
        Assert.assertEquals("Setup2 called once", 1, countSetupRun2.get());
        Assert.assertEquals("Setup3 called twice", 2, countSetupIteration1.get());
        Assert.assertEquals("Setup4 called twice", 2, countSetupIteration2.get());

        // These asserts make no sense for Benchmark tests
//        Assert.assertEquals("Setup5 = invocation count", countInvocations.get(), countSetupInvocation1.get());
//        Assert.assertEquals("Setup6 = invocation count", countInvocations.get(), countSetupInvocation2.get());

        Assert.assertEquals("TearDown1 called once", 1, countTearDownRun1.get());
        Assert.assertEquals("TearDown2 called once", 1, countTearDownRun2.get());
        Assert.assertEquals("TearDown3 called twice", 2, countTearDownIteration1.get());
        Assert.assertEquals("TearDown4 called twice", 2, countTearDownIteration2.get());

        // These two asserts make no sense for Benchmark tests.
//        Assert.assertEquals("TearDown5 = invocation count", countInvocations.get(), countTearDownInvocation1.get());
//        Assert.assertEquals("TearDown6 = invocation count", countInvocations.get(), countTearDownInvocation2.get());
    }
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:21,代碼來源:BenchmarkBenchHelperTimesTest.java

示例4: afterInvocation

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Invocation)
public void afterInvocation() {
    if (invocation == 0) {
        // Only need to check the first invocation
        invocation++;
        for (int i = 0; i < nodes.length; i++) {
            if (nodes[i] != originalNodes[i]) {
                throw new InternalError(String.format("Benchmark method mutated node %d: original=%s, current=%s", i, originalNodes[i], nodes[i]));
            }
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:NodesState.java

示例5: teardownTrial

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
/**
 * Ensures Accumulo and test are cleaned up.
 */
@TearDown(Level.Trial)
public void teardownTrial() throws Exception {
  for (String table : tables) {
    AccumuloInstance.deleteTable(table);
  }

  AccumuloInstance.teardown();
}
 
開發者ID:mit-ll,項目名稱:PACE,代碼行數:12,代碼來源:BenchmarkBase.java

示例6: tearDownIteration

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Iteration)
public void tearDownIteration() {
  storage.write((NoResult.Quiet) storeProvider -> {
    storeProvider.getJobUpdateStore().deleteAllUpdatesAndEvents();
    storeProvider.getLockStore().deleteLocks();
  });
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:8,代碼來源:UpdateStoreBenchmarks.java

示例7: dumpMetrics

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown
        public void dumpMetrics() throws Exception {

            // enable when using yourkit for single runs
//            if (controller != null) {
//                controller.captureSnapshot(Controller.SNAPSHOT_WITH_HEAP);
//            }
            final MetricRegistry metrics = injector.getInstance(MetricRegistry.class);
            // make the registry available to the profiler
            metricRegistry = metrics;
            final ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics)
                    .outputTo(new PrintStream("/tmp/bench-" + directoryName + ".txt"))
                    .build();
            reporter.report();
        }
 
開發者ID:Graylog2,項目名稱:graylog-plugin-pipeline-processor,代碼行數:16,代碼來源:PipelinePerformanceBenchmarks.java

示例8: tearDown

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Trial)
public void tearDown() {
    byteData.free();
    byteCmpData.free();

    shortData.free();
    shortCmpData.free();

    intData.free();
    intCmpData.free();

    longData.free();
    longCmpData.free();
}
 
開發者ID:shunfei,項目名稱:indexr,代碼行數:15,代碼來源:BHCompressBenchmark.java

示例9: cleanup

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Trial)
public void cleanup() throws IOException {
    indexMemCache.close();
    packMemCache.close();
    System.gc();
    FileUtils.deleteDirectory(workDir.toFile());
}
 
開發者ID:shunfei,項目名稱:indexr,代碼行數:8,代碼來源:SegmentBenchmark.java

示例10: detroyTestEnvironment

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown
public void detroyTestEnvironment() throws IOException, InterruptedException {
  clientTransport.close();
  tcpAcceptor.close();
  serverIOReactor.close();
  clientIOReactor.close();
}
 
開發者ID:FIXTradingCommunity,項目名稱:silverflash,代碼行數:8,代碼來源:TlsTcpTransportBenchmark.java

示例11: detroyTestEnvironment

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown
public void detroyTestEnvironment() throws Exception {
  clientTransport.close();
  serverTransport.close();
  if (serverIOReactor != null) {
    serverIOReactor.close();
  }
  if (clientIOReactor != null) {
    clientIOReactor.close();
  }
}
 
開發者ID:FIXTradingCommunity,項目名稱:silverflash,代碼行數:12,代碼來源:UdpTransportBenchmark.java

示例12: detroyTestEnvironment

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown
public void detroyTestEnvironment() throws IOException, InterruptedException {
  clientTransport.close();
  tcpAcceptor.close();
  serverIOReactor.close();
  if (clientIOReactor != null) {
    clientIOReactor.close();
  }
}
 
開發者ID:FIXTradingCommunity,項目名稱:silverflash,代碼行數:10,代碼來源:TcpTransportBenchmark.java

示例13: clear

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
/**
 * We want to always start with an empty inbound. Iteration tear downs are synchronized.
 */
@TearDown(Level.Iteration)
public void clear() {
    // SPSC -> consumer must clear the queue
    in.clear();
    ping = in;
    pong = out;
}
 
開發者ID:Devexperts,項目名稱:lin-check,代碼行數:11,代碼來源:QueueRoundTripLatency.java

示例14: emptyQ

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Iteration)
public void emptyQ() {
    if (marker.get() == null)
        return;
    // sadly the iteration tear down is performed from each participating thread, so we need to guess
    // which is which (can't have concurrent access to poll).
    while (q.poll() != null)
        ;
}
 
開發者ID:Devexperts,項目名稱:lin-check,代碼行數:10,代碼來源:QueueThroughputBusy.java

示例15: validate

import org.openjdk.jmh.annotations.TearDown; //導入依賴的package包/類
@TearDown(Level.Iteration)
public void validate() {
	for (String pattern : sample.getPattern()) {
		List<Integer> result = results.get(pattern);
		sample.validate(pattern, result);
	}
}
 
開發者ID:almondtools,項目名稱:stringbench,代碼行數:8,代碼來源:SinglePatternMatcherBenchmark.java


注:本文中的org.openjdk.jmh.annotations.TearDown類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。