Package ca.jimr.gae.profiler.MiniProfiler

Examples of ca.jimr.gae.profiler.MiniProfiler.Profile


  public void testProfileNotStarted()
  {
    Step s = MiniProfiler.step("Test");
    s.close();

    Profile p = MiniProfiler.stop();
    assertNull("No profile should be generated", p);
  }
View Full Code Here


  }

  @Test
  public void testProfileSingleStep()
  {
    Profile result = null;
    MiniProfiler.start();
    try
    {
      Step s = MiniProfiler.step("Step 1");
      s.close();
    } finally
    {
      result = MiniProfiler.stop();
    }

    assertNotNull("Profile should be generated");
    assertEquals("Request", result.getName());
    assertEquals(0, result.getDepth());
    List<Profile> children = result.getChildren();
    assertEquals(1, children.size());
    Profile child = children.get(0);
    assertEquals("Step 1", child.getName());
    assertEquals(1, child.getDepth());
  }
View Full Code Here

  }

  @Test
  public void testProfileNestedSteps()
  {
    Profile result = null;
    MiniProfiler.start();
    try
    {
      Step s1 = MiniProfiler.step("Step 1");
      Step s11 = MiniProfiler.step("Step 1.1");
      s11.close();
      s1.close();
      Step s2 = MiniProfiler.step("Step 2");
      Step s21 = MiniProfiler.step("Step 2.1");
      s21.close();
      Step s22 = MiniProfiler.step("Step 2.2");
      s22.close();
      s2.close();
    } finally
    {
      result = MiniProfiler.stop();
    }

    assertNotNull("Profile should be generated");
    assertEquals("Request", result.getName());
    assertEquals(0, result.getDepth());
    List<Profile> children = result.getChildren();
    assertEquals(2, children.size());
    Profile child = children.get(0);
    assertEquals("Step 1", child.getName());
    assertEquals(1, child.getDepth());
    List<Profile> children2 = child.getChildren();
    assertEquals(1, children2.size());
    Profile child2 = children2.get(0);
    assertEquals("Step 1.1", child2.getName());
    assertEquals(2, child2.getDepth());
    child = children.get(1);
    assertEquals("Step 2", child.getName());
    assertEquals(1, child.getDepth());
    children2 = child.getChildren();
    assertEquals(2, children2.size());
    child2 = children2.get(0);
    assertEquals("Step 2.1", child2.getName());
    assertEquals(2, child2.getDepth());
    child2 = children2.get(1);
    assertEquals("Step 2.2", child2.getName());
    assertEquals(2, child2.getDepth());   
  }
View Full Code Here

TOP

Related Classes of ca.jimr.gae.profiler.MiniProfiler.Profile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.