congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Profiler.activateProfiling
Code IndexAdd Tabnine to your IDE (free)

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

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

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

@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 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 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

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 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 testProfileServlet() throws Exception {
  Filter filter = new CompositeFilter();
  final CallStackElement total = Profiler.activateProfiling("total");
  filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain());
  Profiler.stop();
  final CallStackElement serviceCall = total.getChildren().iterator().next();
  assertEquals("CompositeFilter#doFilter", serviceCall.getShortSignature());
}
origin: stagemonitor/stagemonitor

@Test
public void testProfiler() {
  ProfilerTest profilerTest = new ProfilerTest();
  CallStackElement total = Profiler.activateProfiling("total");
  Assert.assertEquals(21, profilerTest.method1());
  Profiler.stop();
  Assert.assertEquals(total.toString(), 1, total.getChildren().size());
  Assert.assertEquals(total.toString(), 3, total.getChildren().get(0).getChildren().size());
  final String method5 = total.getChildren().get(0).getChildren().get(2).getSignature();
  Assert.assertTrue(method5, method5.contains("org.stagemonitor.tracing.prof.ProfilerTest.method5"));
}
origin: stagemonitor/stagemonitor

@Test
public void testProfileServlet() throws Exception {
  Servlet servlet = new DispatcherServlet();
  final CallStackElement total = Profiler.activateProfiling("total");
  servlet.service(new MockHttpServletRequest(), new MockHttpServletResponse());
  Profiler.stop();
  final CallStackElement serviceCall = total.getChildren().iterator().next();
  assertEquals("FrameworkServlet#service", serviceCall.getShortSignature());
}
origin: stagemonitor/stagemonitor

  @Test
  public void testDontProfileStagemonitorServlet() throws Exception {
    Servlet servlet = new StagemonitorFileServlet();

    final CallStackElement total = Profiler.activateProfiling("total");
    servlet.service(new MockHttpServletRequest(), new MockHttpServletResponse());
    Profiler.stop();

    assertEquals(0, total.getChildren().size());
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testMeterTimer() {
  CallStackElement total = Profiler.activateProfiling("total");
  testObject.testMethod();
  Profiler.stop();
  final String signature = total.getChildren().get(0).getSignature();
  assertTrue(signature, signature.contains("org.stagemonitor.tracing.MultipleAnnotationsAndProfilerTest$TestObject.testMethod"));
  assertOneMeterExists(name("rate").tag("signature", "MultipleAnnotationsAndProfilerTest$TestObject#testMethod").build());
  assertOneTimerExists(name("timer").tag("signature", "MultipleAnnotationsAndProfilerTest$TestObject#testMethod").build());
}
origin: stagemonitor/stagemonitor

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

  @Test
  public void testCollectElasticsearchQueries() throws Exception {
    CallStackElement total = Profiler.activateProfiling("total");
    client.prepareSearch().setQuery(QueryBuilders.matchAllQuery()).get();
    client.prepareSearch().setQuery(QueryBuilders.matchAllQuery()).setSearchType(SearchType.DFS_QUERY_THEN_FETCH).get();
    Profiler.stop();
    Assert.assertEquals(total.toString(), "POST /_search\n" +
        "{\"query\":{\"match_all\":{\"boost\":1.0}}} ", total.getChildren().get(0).getSignature());
    Assert.assertEquals(total.toString(), "POST /_search?search_type=dfs_query_then_fetch\n" +
        "{\"query\":{\"match_all\":{\"boost\":1.0}}} ", total.getChildren().get(1).getSignature());
  }
}
org.stagemonitor.tracing.profilerProfileractivateProfiling

Javadoc

Activates the profiling for the current thread by setting the provided CallStackElement as the root of the call stack

Popular methods of Profiler

  • addIOCall
  • stop
  • start
  • getMethodCallParent
    Adds the current
  • isProfilingActive
  • addCall
  • clearMethodCallParent
  • deactivateProfiling

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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