Java Code Examples for org.openjdk.jmh.annotations.Mode#AverageTime

The following examples show how to use org.openjdk.jmh.annotations.Mode#AverageTime . 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: ReasoningBenchmark.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void forwardChainingSchemaCachingRDFSInferencer() throws IOException {
	SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore()));

	try (SailRepositoryConnection connection = sail.getConnection()) {
		connection.begin();

		connection.add(resourceAsStream("schema.ttl"), "", RDFFormat.TURTLE);
		addAllDataSingleTransaction(connection);

		connection.commit();
	}

	checkSize(sail);
}
 
Example 2
Source File: MethodInoveBenchmark.java    From j360-tools with Apache License 2.0 5 votes vote down vote up
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.AverageTime)
@Benchmark
@SneakyThrows
public void jdk() {
    PreparedStatement preparedStatement = new PreparedStatement();
    for (int i = 0 ;i <= 10000 ; i++) {
        JdbcMethodInvocation actual = new JdbcMethodInvocation(PreparedStatement.class.getMethod("setObject", int.class, Object.class), new Object[] {1, 100});
        actual.invoke(preparedStatement);
    }
}
 
Example 3
Source File: BenchmarkPinotDataBitSet.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void twoBitContiguousFast() {
  for (int startIndex = 0; startIndex < ROWS; startIndex++) {
    _bitSet2Fast.readInt(startIndex);
  }
}
 
Example 4
Source File: NestedTagContextCreationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/** Build nested tag context. */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public TagContext timeNestedTagContext(Data data) {
  return TagsBenchmarksUtil.createTagContext(
      data.tagger.toBuilder(data.baseTagContext), data.numTags);
}
 
Example 5
Source File: BenchmarkPinotDataBitSet.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void fourBitBulkContiguousUnalignedFast() {
  for (int startIndex = 1; startIndex < ROWS - 48; startIndex += 48) {
    _bitSet4Fast.readInt(startIndex, 48, unalignedUnpacked8Bit);
  }
}
 
Example 6
Source File: ReasoningBenchmark.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void forwardChainingSchemaCachingRDFSInferencerSchema() throws IOException {
	SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore(), createSchema()));

	try (SailRepositoryConnection connection = sail.getConnection()) {
		connection.begin();
		addAllDataSingleTransaction(connection);
		connection.commit();
	}
	checkSize(sail);

}
 
Example 7
Source File: TagContextBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/** Open and close a tag context scope. */
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Scope scopeTagContext(Data data) {
  Scope scope = data.tagger.withTagContext(data.tagContext);
  scope.close();
  return scope;
}
 
Example 8
Source File: Client.java    From rpc-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput, Mode.AverageTime, Mode.SampleTime })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Override
public User getUser() throws Exception {
	return super.getUser();
}
 
Example 9
Source File: ThreadInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with manual context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork
public void manual(Blackhole blackhole) throws InterruptedException {
  Thread t = new Thread(Context.current().wrap(new MyRunnable(blackhole)));
  t.start();
  t.join();
}
 
Example 10
Source File: BenchmarkGroovyExpressionEvaluation.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void groovyCodeSourceMax() {
  List<String> longList = getLongList();
  getMaxGroovyCodeSource(longList);
}
 
Example 11
Source File: ExecutorInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with automatic context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(jvmArgsAppend = "-javaagent:contrib/agent/build/libs/agent.jar")
public void automatic(final Blackhole blackhole) {
  MoreExecutors.directExecutor().execute(new MyRunnable(blackhole));
}
 
Example 12
Source File: ExecutorInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with manual context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork
public void manual(final Blackhole blackhole) {
  MoreExecutors.directExecutor().execute(Context.current().wrap(new MyRunnable(blackhole)));
}
 
Example 13
Source File: DefaultTracerBenchmarks.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({Mode.AverageTime})
@Fork(1)
@Measurement(iterations = 15, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1)
public void measureSpanBuilding() {
  span = tracer.spanBuilder("span").startSpan();
}
 
Example 14
Source File: BasicOperationsBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/** Set status on a span. */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span setStatus(Data data) {
  data.spanToSet.setStatus(STATUS_OK);
  return data.spanToSet;
}
 
Example 15
Source File: VarHandleMarkHolderBenchmark.java    From perfmark with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void stop_name_subname() {
  markHolder.stop(gen, taskName, tagName, nanoTime);
}
 
Example 16
Source File: RecordMultipleViewsBenchmark.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public MeasureMap recordLongSum(Data data) {
  return record(data, StatsBenchmarksUtil.LONG_SUM_MEASURES[0], 11);
}
 
Example 17
Source File: DefaultDirectedGraphBenchmark.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void removeAllVertices80Benchmark(GraphState state) {
  state.graph.removeAllVertices(state.eightyNodes);
}
 
Example 18
Source File: ReadOnlyHttp2HeadersBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
public int readOnlyTrailers() {
    return iterate(ReadOnlyHttp2Headers.trailers(false, buildPairs()));
}
 
Example 19
Source File: DefaultDirectedGraphBenchmark.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void removeAllVertices40Benchmark(GraphState state) {
  state.graph.removeAllVertices(state.fortyNodes);
}
 
Example 20
Source File: CountBenchmark.java    From sofa-tracer with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void countUseCountMatches(Blackhole blackhole) {
    blackhole.consume(StringUtils.countMatches(RPC_ID, '.'));
}