org.openjdk.jmh.annotations.Level Java Examples
The following examples show how to use
org.openjdk.jmh.annotations.Level.
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 |
@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: AbstractSslEngineThroughputBenchmark.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
@Setup(Level.Iteration) public final void setup() throws Exception { ByteBufAllocator allocator = new PooledByteBufAllocator(true); initEngines(allocator); initHandshakeBuffers(); wrapDstBuffer = allocateBuffer(clientEngine.getSession().getPacketBufferSize() << 2); wrapSrcBuffer = allocateBuffer(messageSize); byte[] bytes = new byte[messageSize]; PlatformDependent.threadLocalRandom().nextBytes(bytes); wrapSrcBuffer.put(bytes); wrapSrcBuffer.flip(); // Complete the initial TLS handshake. if (!doHandshake()) { throw new IllegalStateException(); } doSetup(); }
Example #3
Source File: BenchMarkOzoneManager.java From hadoop-ozone with Apache License 2.0 | 6 votes |
@TearDown(Level.Trial) public static void tearDown() { try { lock.lock(); if (scm != null) { scm.stop(); scm.join(); scm = null; om.stop(); om.join(); om = null; FileUtil.fullyDelete(new File(testDir)); } } finally { lock.unlock(); } }
Example #4
Source File: MultiSpanExporterBenchmark.java From opentelemetry-java with Apache License 2.0 | 6 votes |
@Setup(Level.Trial) public final void setup() { SpanExporter[] exporter = new SpanExporter[exporterCount]; Arrays.fill(exporter, new NoopSpanExporter()); this.exporter = MultiSpanExporter.create(Arrays.asList(exporter)); TestSpanData[] spans = new TestSpanData[spanCount]; for (int i = 0; i < spans.length; i++) { spans[i] = TestSpanData.newBuilder() .setTraceId(new TraceId(1, 1)) .setSpanId(new SpanId(1)) .setName("noop") .setKind(Span.Kind.CLIENT) .setStartEpochNanos(1) .setStatus(Status.OK) .setEndEpochNanos(2) .setHasEnded(true) .build(); } this.spans = Arrays.<SpanData>asList(spans); }
Example #5
Source File: StreamingPingPongsPerSecondBenchmark.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
/** * Setup with direct executors, small payloads and the default flow-control window. */ @Setup(Level.Trial) public void setup() throws Exception { super.setup(ExecutorType.DIRECT, ExecutorType.DIRECT, MessageSize.SMALL, MessageSize.SMALL, FlowWindowSize.MEDIUM, ChannelType.NIO, maxConcurrentStreams, channelCount); callCounter = new AtomicLong(); completed = new AtomicBoolean(); record = new AtomicBoolean(); latch = startStreamingCalls(maxConcurrentStreams, callCounter, record, completed, 1); }
Example #6
Source File: MeasureKeyValuePairSort.java From headlong with Apache License 2.0 | 6 votes |
@Setup(Level.Invocation) public void init() { rand.setSeed(rand.nextLong() + System.nanoTime()); arrayList.clear(); byte[] key, value; for (int i = 0; i < SIZE; i++) { key = new byte[MIN_KEY_LEN + rand.nextInt(KEY_LEN_BOUND - MIN_KEY_LEN)]; value = new byte[rand.nextInt(VALUE_LEN_BOUND)]; rand.nextBytes(key); rand.nextBytes(value); KeyValuePair pair = new KeyValuePair(key, value); array[i] = pair; arrayList.add(pair); } arraysArrayList = Arrays.asList(Arrays.copyOf(array, array.length)); }
Example #7
Source File: MessageBufferBenchmarks_PutPeekPoll.java From extension-kafka with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void prepareTestData() { testData = new KafkaEventMessage[bufferSize]; int i = 0; while (i < bufferSize) { testData[i++] = message(0, i, i + 1); testData[i++] = message(1, i, i + 1); testData[i++] = message(2, i, i + 1); testData[i++] = message(3, i, i + 1); } }
Example #8
Source File: TransitionBenchmark.java From teku with Apache License 2.0 | 5 votes |
@Setup(Level.Iteration) public void skipAndPrefetch() throws Exception { if (lastResult != null && (lastResult.getBlock().getSlot().longValue() + 1) % Constants.SLOTS_PER_EPOCH == 0) { // import block with epoch transition importNextBlock(); } prefetchBlock(); }
Example #9
Source File: HandlerRegistryBenchmark.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
/** * Set up the registry. */ @Setup(Level.Trial) public void setup() throws Exception { registry = new MutableHandlerRegistry(); fullMethodNames = new ArrayList<>(serviceCount * methodCountPerService); for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) { String serviceName = randomString(); ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition.builder(serviceName); for (int methodIndex = 0; methodIndex < methodCountPerService; ++methodIndex) { String methodName = randomString(); MethodDescriptor<Void, Void> methodDescriptor = MethodDescriptor.<Void, Void>newBuilder() .setType(MethodDescriptor.MethodType.UNKNOWN) .setFullMethodName(MethodDescriptor.generateFullMethodName(serviceName, methodName)) .setRequestMarshaller(TestMethodDescriptors.voidMarshaller()) .setResponseMarshaller(TestMethodDescriptors.voidMarshaller()) .build(); serviceBuilder.addMethod(methodDescriptor, new ServerCallHandler<Void, Void>() { @Override public Listener<Void> startCall(ServerCall<Void, Void> call, Metadata headers) { return null; } }); fullMethodNames.add(methodDescriptor.getFullMethodName()); } registry.addService(serviceBuilder.build()); } }
Example #10
Source File: StreamingPingPongsPerSecondBenchmark.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
/** * 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 #11
Source File: FastAvroSerdesBenchmark.java From avro-util with BSD 2-Clause "Simplified" License | 5 votes |
@Setup(Level.Trial) public void prepare() throws Exception { // generate avro record and bytes data generatedRecord = (GenericData.Record) generator.generate(properties); serializedBytes = serializeGeneratedRecord(generatedRecord); serializer = new AvroGenericSerializer(benchmarkSchema); fastSerializer = new AvroGenericSerializer(new FastGenericDatumWriter<>(benchmarkSchema)); deserializer = new GenericDatumReader<>(benchmarkSchema); fastDeserializer = new FastGenericDatumReader<>(benchmarkSchema); }
Example #12
Source File: ConnectableBufferOutputStreamBenchmark.java From servicetalk with Apache License 2.0 | 5 votes |
@Setup(Level.Iteration) public void setup() { data = new byte[dataSize]; cbos = new ConnectableBufferOutputStream(PREFER_HEAP_ALLOCATOR); publisher = cbos.connect(); // Don't remove this, JMH somehow provides a default which break everything subscription = null; }
Example #13
Source File: UnitializedArrayBenchmark.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setupTrial() { if (PlatformDependent.javaVersion() < 9) { throw new IllegalStateException("Needs Java9"); } if (!PlatformDependent.hasUnsafe()) { throw new IllegalStateException("Needs Unsafe"); } }
Example #14
Source File: PlatformDependentBenchmark.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setup() { bytes1 = new byte[size]; bytes2 = new byte[size]; for (int i = 0; i < size; i++) { bytes1[i] = bytes2[i] = (byte) i; } }
Example #15
Source File: SingleThreadBlockingQpsBenchmark.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
/** * Stop the server and client channels. */ @Override @TearDown(Level.Trial) public void teardown() throws Exception { Thread.sleep(5000); super.teardown(); }
Example #16
Source File: UnaryCallResponseBandwidthBenchmark.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
/** * Stop the running calls then stop the server and client channels. */ @Override @TearDown(Level.Trial) public void teardown() throws Exception { completed.set(true); Thread.sleep(5000); super.teardown(); }
Example #17
Source File: MeasureFunction.java From headlong with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setUp() { f = new Function("sam(bytes,bool,uint256[])"); args = Tuple.of( Strings.decode("dave", Strings.UTF_8), true, new BigInteger[] { BigInteger.ONE, BigInteger.valueOf(2), BigInteger.valueOf(3) } ); }
Example #18
Source File: StreamingResponseBandwidthBenchmark.java From grpc-nebula-java with Apache License 2.0 | 5 votes |
/** * 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 #19
Source File: CirclePerformance.java From commons-geometry with Apache License 2.0 | 5 votes |
/** Set up the instance for the benchmark. */ @Setup(Level.Iteration) public void setup() { final Circle circle = randomCircle(RandomSource.create(RandomSource.XO_RO_SHI_RO_128_PP)); tree = circle.toTree(getSegments()); }
Example #20
Source File: Benchmarks.java From sdn-rx with Apache License 2.0 | 5 votes |
@Setup(Level.Iteration) public void prepareTestData() throws IOException { try (BufferedReader moviesReader = new BufferedReader( new InputStreamReader(this.getClass().getResourceAsStream("/movies.cypher"))); Session session = driver.session()) { String moviesCypher = moviesReader.lines().collect(Collectors.joining(" ")); session.run("CREATE INDEX ON :Movie(title)"); session.run("MATCH (n) DETACH DELETE n"); session.run(moviesCypher); } }
Example #21
Source File: LazyBenchmarkIT.java From spring-init with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void start() throws Exception { if (sample != Sample.demo) { setProfiles(sample.toString()); } super.before(); }
Example #22
Source File: SslEngineHandshakeBenchmark.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Setup(Level.Iteration) public void setup() { allocator = new PooledByteBufAllocator(true); // Init an engine one time and create the buffers needed for an handshake so we can use them in the benchmark initEngines(allocator); initHandshakeBuffers(); destroyEngines(); }
Example #23
Source File: BenchmarkSpatialJoin.java From presto with Apache License 2.0 | 5 votes |
@Setup(Level.Invocation) public void createPointsTable() { // Generate random points within the approximate bounding box of the US polygon: // POLYGON ((-124 27, -65 27, -65 49, -124 49, -124 27)) queryRunner.execute(format("CREATE TABLE memory.default.points AS " + "SELECT 'p' || cast(elem AS VARCHAR) as name, xMin + (xMax - xMin) * random() as longitude, yMin + (yMax - yMin) * random() as latitude " + "FROM (SELECT -124 AS xMin, -65 AS xMax, 27 AS yMin, 49 AS yMax) " + "CROSS JOIN UNNEST(sequence(1, %s)) AS t(elem)", pointCount)); }
Example #24
Source File: BenchmarkSpatialJoin.java From presto with Apache License 2.0 | 5 votes |
@TearDown(Level.Invocation) public void dropPointsTable() { queryRunner.inTransaction(queryRunner.getDefaultSession(), transactionSession -> { Metadata metadata = queryRunner.getMetadata(); Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, QualifiedObjectName.valueOf("memory.default.points")); assertTrue(tableHandle.isPresent(), "Table memory.default.points does not exist"); metadata.dropTable(transactionSession, tableHandle.get()); return null; }); }
Example #25
Source File: SlimBenchmarkIT.java From spring-init with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void start() throws Exception { if (sample != Sample.demo) { setProfiles(sample.toString(), "slim"); } else { setProfiles("slim"); } super.before(); }
Example #26
Source File: SymSpellIndexBenchMark.java From customized-symspell with MIT License | 5 votes |
@Setup(Level.Iteration) public void setup() throws SpellCheckException, IOException { SpellCheckSettings spellCheckSettings = SpellCheckSettings.builder() .maxEditDistance(maxEditDistance).build(); DataHolder dataHolder = new InMemoryDataHolder(spellCheckSettings, new Murmur3HashFunction()); spellChecker = new SymSpellCheck(dataHolder, getStringDistance(spellCheckSettings, null), spellCheckSettings); }
Example #27
Source File: MtcnnServiceBenchmark.java From mtcnn-java with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setUp() throws IOException { Nd4j.ENFORCE_NUMERICAL_STABILITY = false; mtcnnService = new MtcnnService(30, 0.709, new double[] { 0.6, 0.7, 0.7 }); image = new Java2DNativeImageLoader().asMatrix( new DefaultResourceLoader().getResource("classpath:/VikiMaxiAdi.jpg").getInputStream()) .get(point(0), all(), all(), all()).dup(); }
Example #28
Source File: LauncherState.java From spring-init with Apache License 2.0 | 5 votes |
@Setup(Level.Invocation) public void start() throws Exception { System.setProperty("server.port", "0"); System.setProperty("spring.jmx.enabled", "false"); System.setProperty("spring.config.location", "file:./src/main/resources/application.properties"); System.setProperty("spring.main.logStartupInfo", "false"); for (Object key : this.args.keySet()) { System.setProperty(key.toString(), this.args.getProperty(key.toString())); } }
Example #29
Source File: AsciiStringBenchmark.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setup() { byte[] bytes = new byte[size]; random.nextBytes(bytes); asciiString = new AsciiString(bytes, false); string = new String(bytes, CharsetUtil.US_ASCII); }
Example #30
Source File: RoundRobinLoadBalancerSDEventsBenchmark.java From servicetalk with Apache License 2.0 | 5 votes |
@Setup(Level.Trial) public void setup() { final int removalStride = 5; availableEvents = new ArrayList<>(ops); mixedEvents = new ArrayList<>(ops); for (int i = 1; i <= ops; ++i) { if (i % removalStride == 0) { mixedEvents.add(new DefaultServiceDiscovererEvent<>(createUnresolved("127.0.0." + (i - 1), 0), false)); } else { mixedEvents.add(new DefaultServiceDiscovererEvent<>(createUnresolved("127.0.0." + i, 0), true)); } availableEvents.add(new DefaultServiceDiscovererEvent<>(createUnresolved("127.0.0." + i, 0), true)); } }