org.openjdk.jmh.annotations.Scope Java Examples

The following examples show how to use org.openjdk.jmh.annotations.Scope. 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: GraphState.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("try")
public GraphState() {
    // Ensure a debug configuration for this thread is initialized
    if (Debug.isEnabled() && DebugScope.getConfig() == null) {
        DebugEnvironment.initialize(System.out);
    }

    GraalState graal = new GraalState();
    ResolvedJavaMethod method = graal.metaAccess.lookupJavaMethod(getMethodFromMethodSpec(getClass()));
    StructuredGraph structuredGraph = null;
    try (Debug.Scope s = Debug.scope("GraphState", method)) {
        structuredGraph = preprocessOriginal(getGraph(graal, method));
    } catch (Throwable t) {
        Debug.handle(t);
    }
    this.originalGraph = structuredGraph;
}
 
Example #2
Source File: DefaultTracerBenchmarks.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
/** Benchmark the full span lifecycle. */
@Benchmark
@BenchmarkMode({Mode.AverageTime})
@Fork(1)
@Measurement(iterations = 15, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1)
public void measureFullSpanLifecycle() {
  span = tracer.spanBuilder("span").startSpan();
  try (io.opentelemetry.context.Scope ignored = tracer.withSpan(span)) {
    // no-op
  } finally {
    span.end();
  }
}
 
Example #3
Source File: DefaultTracerBenchmarks.java    From opentelemetry-java with Apache License 2.0 5 votes vote down vote up
/** Benchmark just the scope lifecycle. */
@Benchmark
@BenchmarkMode({Mode.AverageTime})
@Fork(1)
@Measurement(iterations = 15, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1)
public void measureScopeLifecycle() {
  try (io.opentelemetry.context.Scope ignored = tracer.withSpan(span)) {
    // no-op
  }
}
 
Example #4
Source File: GraalCompilerState.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("try")
protected void initializeMethod() {
    GraalState graal = new GraalState();
    ResolvedJavaMethod method = graal.metaAccess.lookupJavaMethod(getMethod());
    StructuredGraph structuredGraph = null;
    try (Debug.Scope s = Debug.scope("GraphState", method)) {
        structuredGraph = preprocessOriginal(getGraph(graal, method, useProfilingInfo()));
    } catch (Throwable t) {
        Debug.handle(t);
    }
    this.originalGraph = structuredGraph;
}
 
Example #5
Source File: SpringWebFluxBenchmarks.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Benchmark
public void tracedClient_get_resumeTrace() throws Exception {
	try (CurrentTraceContext.Scope scope = Tracing.current().currentTraceContext()
			.newScope(defaultTraceContext)) {
		get(tracedClient);
	}
}
 
Example #6
Source File: TracerBenchmarks.java    From brave with Apache License 2.0 4 votes vote down vote up
void currentSpan(Tracer tracer, TraceContext context, boolean tag) {
  try (CurrentTraceContext.Scope scope = tracer.currentTraceContext.newScope(context)) {
    Span span = tracer.currentSpan();
    if (tag) span.tag("customer.id", "1234");
  }
}