本文整理汇总了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);
}
}
示例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());
}
示例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());
}
示例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]));
}
}
}
}
示例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();
}
示例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();
});
}
示例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();
}
示例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());
}
示例10: detroyTestEnvironment
import org.openjdk.jmh.annotations.TearDown; //导入依赖的package包/类
@TearDown
public void detroyTestEnvironment() throws IOException, InterruptedException {
clientTransport.close();
tcpAcceptor.close();
serverIOReactor.close();
clientIOReactor.close();
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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)
;
}
示例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);
}
}