Codota Logo
Profiler.activateProfiling
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
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
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now