本文整理匯總了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);
}
}