congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Profiler
Code IndexAdd Tabnine to your IDE (free)

How to use
Profiler
in
org.stagemonitor.tracing.profiler

Best Java code snippets using org.stagemonitor.tracing.profiler.Profiler (Showing top 20 results out of 315)

origin: stagemonitor/stagemonitor

static void method1_2() {
  Profiler.start("method1_2()");
  Profiler.addIOCall("select * from user", 50000000);
  Profiler.addIOCall("select * from address", 50000000);
  method1_2_1();
  final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
  Profiler.stop();
  thisCallStackElement.setExecutionTime(500000000);
}
static void method1_2_1() {
origin: stagemonitor/stagemonitor

static CallStackElement method0() {
  final CallStackElement callStackElement = Profiler.activateProfiling("method0()");
  try {
    method1();
    return callStackElement;
  } finally {
    final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
    Profiler.stop();
    thisCallStackElement.setExecutionTime(1000000000);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testNoProfilingIfNotActive() {
  assertFalse(Profiler.isProfilingActive());
  Profiler.start("dummy");
  assertNull(Profiler.getMethodCallParent());
  Profiler.stop();
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodExit(inline = false, onThrowable = Throwable.class)
public static void onAfterEvaluate() {
  final CallStackElement currentFreemarkerCall = Profiler.getMethodCallParent();
  Profiler.stop();
  removeCurrentNodeIfItHasNoChildren(currentFreemarkerCall);
}
origin: stagemonitor/stagemonitor

  public String getFoo() {
    Profiler.start("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
    try {
      return "foo";
    } finally {
      Profiler.stop();
    }
  }
}
origin: stagemonitor/stagemonitor

  static void method1_2_1() {
    Profiler.start("method1_2_1()");
    final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
    Profiler.stop();
    thisCallStackElement.setExecutionTime(250000000);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testInnerPrivateMethod() {
  class Test {
    private void test() {
    }
  }
  Test test = new Test();
  CallStackElement total = Profiler.activateProfiling("total");
  test.test();
  Profiler.stop();
  Assert.assertFalse(total.toString(), total.getChildren().iterator().next().getSignature().contains("access$"));
}
origin: stagemonitor/stagemonitor

@Test
public void testFreemarkerProfilingMethodCall() throws Exception {
  final CallStackElement callTree = Profiler.activateProfiling("testFreemarkerProfilingMethodCall");
  final String renderedTemplate = processTemplate("test.ftl", "${templateModel.getFoo()}", new TemplateModel());
  Profiler.stop();
  Profiler.deactivateProfiling();
  assertThat(renderedTemplate).isEqualTo("foo");
  System.out.println(callTree);
  assertThat(callTree.getChildren()).hasSize(1);
  final CallStackElement freemarkerNode = callTree.getChildren().get(0);
  assertThat(freemarkerNode.getSignature()).isEqualTo("test.ftl:1#templateModel.getFoo()");
  assertThat(freemarkerNode.getChildren()).hasSize(1);
  final CallStackElement templateModelNode = freemarkerNode.getChildren().get(0);
  assertThat(templateModelNode.getSignature()).isEqualTo("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodEnter(inline = false)
public static void addIOCall(@Advice.Argument(1) ActionRequest actionRequestBuilder) {
  if (actionRequestBuilder instanceof SearchRequest) {
    Profiler.addIOCall(ElasticsearchSearchQueryTransformer.getSearchRequestAsString((SearchRequest) actionRequestBuilder), 0L);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testProfilerActive() {
  assertFalse(Profiler.isProfilingActive());
  Profiler.activateProfiling("");
  assertTrue(Profiler.isProfilingActive());
  Profiler.deactivateProfiling();
  assertFalse(Profiler.isProfilingActive());
}
origin: stagemonitor/stagemonitor

@Override
public void onStart(SpanWrapper spanWrapper) {
  final SpanContextInformation contextInfo = SpanContextInformation.forSpan(spanWrapper);
  if (tracingPlugin.isSampled(spanWrapper) && contextInfo.getPreExecutionInterceptorContext() != null) {
    determineIfEnableProfiler(spanWrapper, contextInfo);
    if (!Profiler.isProfilingActive() && contextInfo.getPreExecutionInterceptorContext().isCollectCallTree()) {
      contextInfo.setCallTree(Profiler.activateProfiling("total"));
    }
  }
}
origin: stagemonitor/stagemonitor

@Override
public void onFinish(SpanWrapper spanWrapper, String operationName, long durationNanos) {
  final SpanContextInformation contextInfo = SpanContextInformation.forSpan(spanWrapper);
  if (contextInfo.getCallTree() != null) {
    try {
      Profiler.stop();
      if (tracingPlugin.isSampled(spanWrapper)) {
        determineIfExcludeCallTree(contextInfo);
        if (isAddCallTreeToSpan(contextInfo, operationName)) {
          addCallTreeToSpan(contextInfo, spanWrapper, operationName);
        }
      }
    } finally {
      Profiler.clearMethodCallParent();
    }
  }
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodExit(onThrowable = Throwable.class)
public static void exit() {
  Profiler.stop();
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodEnter
public static void enter(@ProfilerSignature String signature) {
  Profiler.start(signature);
}
origin: stagemonitor/stagemonitor

public static void addIOCall(String signature, long executionTimeNanos) {
  addCall(signature + ' ', executionTimeNanos);
}
origin: stagemonitor/stagemonitor

static void method1_1_1() {
  Profiler.start("method1_1_1()");
  final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
  Profiler.stop();
  thisCallStackElement.setExecutionTime(200000000);
}
origin: stagemonitor/stagemonitor

@Test
public void testDontProfileStagemonitorServlet() throws Exception {
  Filter filter = new HttpRequestMonitorFilter();
  final CallStackElement total = Profiler.activateProfiling("total");
  filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain());
  Profiler.stop();
  assertEquals(0, total.getChildren().size());
}
origin: stagemonitor/stagemonitor

@Test
public void testFreemarkerProfiling() throws Exception {
  final CallStackElement callTree = Profiler.activateProfiling("testFreemarkerProfiling");
  final String renderedTemplate = processTemplate("test.ftl", "${templateModel.foo}", new TemplateModel());
  Profiler.stop();
  Profiler.deactivateProfiling();
  assertThat(renderedTemplate).isEqualTo("foo");
  System.out.println(callTree);
  assertThat(callTree.getChildren()).hasSize(1);
  final CallStackElement freemarkerNode = callTree.getChildren().get(0);
  assertThat(freemarkerNode.getSignature()).isEqualTo("test.ftl:1#templateModel.foo");
  assertThat(freemarkerNode.getChildren()).hasSize(1);
  final CallStackElement templateModelNode = freemarkerNode.getChildren().get(0);
  assertThat(templateModelNode.getSignature()).isEqualTo("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
}
origin: stagemonitor/stagemonitor

@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
  final Scope scope = new ExternalHttpRequest(tracingPlugin.getTracer(), request.getMethod().toString(), removeQuery(request.getURI()), request.getURI().getHost(), request.getURI().getPort()).createScope();
  try {
    Profiler.start(request.getMethod().toString() + " " + request.getURI() + " ");
    tracingPlugin.getTracer().inject(scope.span().context(), Format.Builtin.HTTP_HEADERS, new SpringHttpRequestInjectAdapter(request));
    return execution.execute(request, body);
  } finally {
    Profiler.stop();
    scope.close();
  }
}
origin: stagemonitor/stagemonitor

@Override
public void onAfterAnyExecute(StatementInformation statementInformation, long timeElapsedNanos, SQLException e) {
  final Scope activeScope = tracingPlugin.getTracer().scopeManager().active();
  if (activeScope != null) {
    final Span span = activeScope.span();
    if (statementInformation.getConnectionInformation().getDataSource() instanceof DataSource && jdbcPlugin.isCollectSql()) {
      MetaData metaData = dataSourceUrlMap.get(statementInformation.getConnectionInformation().getDataSource());
      Tags.PEER_SERVICE.set(span, metaData.serviceName);
      span.setTag("db.type", metaData.productName);
      span.setTag("db.user", metaData.userName);
      if (StringUtils.isNotEmpty(statementInformation.getSql())) {
        String sql = getSql(statementInformation.getSql(), statementInformation.getSqlWithValues());
        Profiler.addIOCall(sql, timeElapsedNanos);
        span.setTag(AbstractExternalRequest.EXTERNAL_REQUEST_METHOD, getMethod(sql));
        span.setTag(DB_STATEMENT, sql);
      }
    }
    tracingPlugin.getRequestMonitor().monitorStop();
  }
}
org.stagemonitor.tracing.profilerProfiler

Most used methods

  • addIOCall
  • stop
  • activateProfiling
    Activates the profiling for the current thread by setting the provided CallStackElement as the root
  • start
  • getMethodCallParent
    Adds the current
  • isProfilingActive
  • addCall
  • clearMethodCallParent
  • deactivateProfiling

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • JOptionPane (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now