Java Code Examples for org.openjdk.jmh.annotations.Level#Trial

The following examples show how to use org.openjdk.jmh.annotations.Level#Trial . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpResponseDecoderBenchmark.java    From servicetalk with Apache License 2.0 6 votes vote down vote up
@Setup(Level.Trial)
public void setup() {
    final HttpResponseStatus status = status(statusCode);
    final Buffer responseBuffer = PREFER_DIRECT_ALLOCATOR.newBuffer(100);
    HTTP_1_1.writeTo(responseBuffer);
    responseBuffer.writeByte(SP);
    status.writeTo(responseBuffer);
    responseBuffer.writeShort(CRLF_SHORT);
    responseBuffer.writeBytes("content-length: 0".getBytes(US_ASCII));
    responseBuffer.writeShort(CRLF_SHORT);
    responseBuffer.writeShort(CRLF_SHORT);
    responseByteBuf = toByteBuf(responseBuffer.slice());

    channel = new EmbeddedChannel(new HttpResponseDecoder(new ArrayDeque<>(),
            getByteBufAllocator(DEFAULT_ALLOCATOR), DefaultHttpHeadersFactory.INSTANCE, 8192, 8192));
}
 
Example 2
Source File: PerfTestFairQueuingPacketScheduler.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Setup(Level.Trial)
public void setup(BenchmarkParams params) {
   clock = NetworkClocks.system();
   scheduler = PacketSchedulers.<Packet>fairQueuing()
      .blockOnQueueFull()
      //.useArrayQueue(qSize)
      //.useLinkedQueue(qSize)
      .useLinkedTransferQueue()
      .build();

   producers = new PacketScheduler.Producer[params.getThreads()][qPerThr];
   for (int p = 0; p < producers.length; ++p) {
      for (int q = 0; q < producers[p].length; ++q) {
         producers[p][q] = scheduler.attach();
      }
   }
}
 
Example 3
Source File: IntObjectHashMapBenchmark.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@Setup(Level.Trial)
public void setup() {
    switch(mapType) {
        case AGRONA: {
            environment = new AgronaEnvironment();
            break;
        }
        case NETTY: {
            environment = new NettyEnvironment();
            break;
        }
        default: {
            throw new IllegalStateException("Invalid mapType: " + mapType);
        }
    }
}
 
Example 4
Source File: StreamingResponseBandwidthBenchmark.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
/**
 * Setup with direct executors and one channel.
 */
@Setup(Level.Trial)
public void setup() throws Exception {
  super.setup(ExecutorType.DIRECT,
      ExecutorType.DIRECT,
      MessageSize.SMALL,
      responseSize,
      clientInboundFlowWindow,
      ChannelType.NIO,
      maxConcurrentStreams,
      1);
  callCounter = new AtomicLong();
  completed = new AtomicBoolean();
  record = new AtomicBoolean();
  latch = startFlowControlledStreamingCalls(maxConcurrentStreams, callCounter, record, completed,
      responseSize.bytes());
}
 
Example 5
Source File: ActrBenchmarkIT.java    From spring-init with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Trial)
public void start() throws Exception {
	if (sample != Sample.noactr) {
		setProfiles("actr");
	}
	addArgs("-Dmanagement.endpoints.enabled-by-default=false");
	if (sample.getEndpoints().length > 0) {
		addArgs(Stream.of(sample.getEndpoints())
				.map(value -> "-Dmanagement.endpoint." + value + ".enabled=true")
				.collect(Collectors.toList()).toArray(new String[0]));
	}
	super.before();
}
 
Example 6
Source File: StreamingPingPongsPerSecondBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Stop the running calls then stop the server and client channels.
 */
@Override
@TearDown(Level.Trial)
public void teardown() throws Exception {
  completed.set(true);
  if (!latch.await(5, TimeUnit.SECONDS)) {
    logger.warning("Failed to shutdown all calls.");
  }
  super.teardown();
}
 
Example 7
Source File: MessageComparatorBenchmark.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Trial)
public void init() {
    File dictionaryFile = new File("src/main/workspace/cfg/dictionaries/test_aml.xml");
    IDictionaryStructure dictionary;

    try(InputStream dictionaryStream = new FileInputStream(dictionaryFile)) {
        dictionary = new XmlDictionaryStructureLoader().load(dictionaryStream);
    } catch(IOException e) {
        throw new EPSCommonException(e);
    }

    actual = createActualMessage();
    expected = createExpectedMessage();
    settings = new ComparatorSettings().setDictionaryStructure(dictionary);
}
 
Example 8
Source File: StreamingResponseBandwidthBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Stop the running calls then stop the server and client channels.
 */
@Override
@TearDown(Level.Trial)
public void teardown() throws Exception {
  completed.set(true);
  if (!latch.await(5, TimeUnit.SECONDS)) {
    System.err.println("Failed to shutdown all calls.");
  }
  super.teardown();
}
 
Example 9
Source File: ScheduledFutureTaskBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Trial)
public void stop() throws Exception {
    executor.shutdownGracefully().syncUninterruptibly();
}
 
Example 10
Source File: NoPriorityByteDistributionBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Trial)
public void tearDownTrial() throws Exception {
    ctx.close();
}
 
Example 11
Source File: MessageBufferBenchmarks_PutPeekTake.java    From extension-kafka with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void createBuffer() {
    buffer = new SortedKafkaMessageBuffer<>(bufferSize);
}
 
Example 12
Source File: RedisEncoderBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Trial)
public void teardown() {
    content.release();
    content = null;
}
 
Example 13
Source File: NettyPipelinedConnectionBenchmark.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setup() throws ExecutionException, InterruptedException {
    executorService = Executors.newCachedThreadPool();
    pipelinedConnection = new NettyPipelinedConnection<>(newNettyConnection());
    prewarmExecutorThreads(executorService, 5);
}
 
Example 14
Source File: MethodHandleGeneratorBenchmark.java    From perfmark with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setUp() {
  generator.setGeneration(Generator.FAILURE);
}
 
Example 15
Source File: CompletableProcessorBenchmark.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setup() {
    executorService = Executors.newCachedThreadPool();
}
 
Example 16
Source File: ResourceLeakDetectorRecordBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setup() {
    level = ResourceLeakDetector.getLevel();
    ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
}
 
Example 17
Source File: HttpResponseStatusBenchmark.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public void setup() {
    statusCode = 505;
    reasonPhrase = "HTTP Version Not Supported";
    buffer = PREFER_HEAP_RO_ALLOCATOR.fromAscii(statusCode + " " + reasonPhrase);
}
 
Example 18
Source File: HpackEncoderBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Trial)
public void tearDown() {
    output.release();
}
 
Example 19
Source File: SpanPipelineBenchmark.java    From opentelemetry-java with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public final void setup() {
  SpanExporter exporter = new NoOpSpanExporter();
  OpenTelemetrySdk.getTracerProvider()
      .addSpanProcessor(SimpleSpanProcessor.newBuilder(exporter).build());
}
 
Example 20
Source File: BenchMarkOzoneManager.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Trial)
public static void initialize()
    throws Exception {
  try {
    lock.lock();
    if (scm == null) {
      OzoneConfiguration conf = new OzoneConfiguration();
      testDir = GenesisUtil.getTempPath()
          .resolve(RandomStringUtils.randomNumeric(7)).toString();
      conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, testDir);

      GenesisUtil.configureSCM(conf, 10);
      GenesisUtil.configureOM(conf, 20);
      conf.setInt(OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT,
          numContainersPerPipeline);
      GenesisUtil.addPipelines(ReplicationFactor.THREE, numPipelines, conf);

      scm = GenesisUtil.getScm(conf, new SCMConfigurator());
      scm.start();
      om = GenesisUtil.getOm(conf);
      om.start();

      // prepare SCM
      PipelineManager pipelineManager = scm.getPipelineManager();
      for (Pipeline pipeline : pipelineManager
          .getPipelines(ReplicationType.RATIS, ReplicationFactor.THREE)) {
        pipelineManager.openPipeline(pipeline.getId());
      }
      scm.getEventQueue().fireEvent(SCMEvents.SAFE_MODE_STATUS,
          new SCMSafeModeManager.SafeModeStatus(false, false));
      Thread.sleep(1000);

      // prepare OM
      om.createVolume(new OmVolumeArgs.Builder().setVolume(volumeName)
          .setAdminName(UserGroupInformation.getLoginUser().getUserName())
          .setOwnerName(UserGroupInformation.getLoginUser().getUserName())
          .build());
      om.createBucket(new OmBucketInfo.Builder().setBucketName(bucketName)
          .setVolumeName(volumeName).build());
      createKeys(100000);
    }
  } finally {
    lock.unlock();
  }
}