当前位置: 首页>>代码示例>>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;未经允许,请勿转载。