org.openjdk.jmh.annotations.Mode#AverageTime ( )源码实例Demo

下面列出了org.openjdk.jmh.annotations.Mode#AverageTime ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: rdf4j   文件: ReasoningBenchmark.java
@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);
}
 
源代码2 项目: j360-tools   文件: MethodInoveBenchmark.java
@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);
    }
}
 
/** 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;
}
 
@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();
}
 
/**
 * 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)));
}
 
/**
 * 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));
}
 
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void groovyCodeSourceMax() {
  List<String> longList = getLongList();
  getMaxGroovyCodeSource(longList);
}
 
/**
 * 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();
}
 
源代码9 项目: rpc-benchmark   文件: Client.java
@Benchmark
@BenchmarkMode({ Mode.Throughput, Mode.AverageTime, Mode.SampleTime })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Override
public User getUser() throws Exception {
	return super.getUser();
}
 
源代码10 项目: opencensus-java   文件: TagContextBenchmark.java
/** 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;
}
 
源代码11 项目: rdf4j   文件: ReasoningBenchmark.java
@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);

}
 
源代码12 项目: incubator-pinot   文件: BenchmarkPinotDataBitSet.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void fourBitBulkContiguousUnalignedFast() {
  for (int startIndex = 1; startIndex < ROWS - 48; startIndex += 48) {
    _bitSet4Fast.readInt(startIndex, 48, unalignedUnpacked8Bit);
  }
}
 
/** 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);
}
 
源代码14 项目: incubator-pinot   文件: BenchmarkPinotDataBitSet.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void twoBitContiguousFast() {
  for (int startIndex = 0; startIndex < ROWS; startIndex++) {
    _bitSet2Fast.readInt(startIndex);
  }
}
 
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public MeasureMap recordLongSum(Data data) {
  return record(data, StatsBenchmarksUtil.LONG_SUM_MEASURES[0], 11);
}
 
源代码16 项目: perfmark   文件: VarHandleMarkHolderBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void stop_name_subname() {
  markHolder.stop(gen, taskName, tagName, nanoTime);
}
 
源代码17 项目: calcite   文件: DefaultDirectedGraphBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void removeAllVertices80Benchmark(GraphState state) {
  state.graph.removeAllVertices(state.eightyNodes);
}
 
@Benchmark
@BenchmarkMode(Mode.AverageTime)
public int readOnlyTrailers() {
    return iterate(ReadOnlyHttp2Headers.trailers(false, buildPairs()));
}
 
源代码19 项目: calcite   文件: DefaultDirectedGraphBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void removeAllVertices40Benchmark(GraphState state) {
  state.graph.removeAllVertices(state.fortyNodes);
}
 
源代码20 项目: sofa-tracer   文件: CountBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void countUseCountMatches(Blackhole blackhole) {
    blackhole.consume(StringUtils.countMatches(RPC_ID, '.'));
}