Search in sources :

Example 6 with Profile

use of com.insightfullogic.honest_profiler.core.profiles.Profile in project honest-profiler by jvm-profiling-tools.

the class ProfileTreeTest method assertProfileHasSingleTree.

private ProfileNode assertProfileHasSingleTree() {
    Profile profile = listener.getProfile();
    List<ProfileTree> trees = profile.getTrees();
    assertEquals(1, trees.size());
    return trees.get(0).getRootNode();
}
Also used : ProfileTree(com.insightfullogic.honest_profiler.core.profiles.ProfileTree) Profile(com.insightfullogic.honest_profiler.core.profiles.Profile)

Example 7 with Profile

use of com.insightfullogic.honest_profiler.core.profiles.Profile in project honest-profiler by jvm-profiling-tools.

the class ProfileViewTest method rendersMultiBranchProfile.

@Test
public void rendersMultiBranchProfile() {
    ProfileNode left = new ProfileNode(ProfileFixtures.println, 1, 2);
    ProfileNode right = new ProfileNode(ProfileFixtures.append, 1, 2);
    ProfileNode root = new ProfileNode(ProfileFixtures.printf, 1, 1, asList(left, right));
    Profile profile = new Profile(2, asList(new FlatProfileEntry(ProfileFixtures.printf, 1, 0, 1)), asList(new FlatProfileEntry(ProfileFixtures.printf, 1, 0, 1)), toTrees(root));
    ui.accept(profile);
    console.isShowingTraces(2);
    console.displaysMethod(ProfileFixtures.printf);
    console.displaysMethod(ProfileFixtures.append);
    console.displaysMethod(ProfileFixtures.println);
    console.outputContains("50.0");
    console.outputContains("100.0");
}
Also used : ProfileNode(com.insightfullogic.honest_profiler.core.profiles.ProfileNode) FlatProfileEntry(com.insightfullogic.honest_profiler.core.collector.FlatProfileEntry) Profile(com.insightfullogic.honest_profiler.core.profiles.Profile) Test(org.junit.Test)

Example 8 with Profile

use of com.insightfullogic.honest_profiler.core.profiles.Profile in project honest-profiler by jvm-profiling-tools.

the class ProfileViewTest method rendersSingleMethod.

@Test
public void rendersSingleMethod() {
    ProfileNode root = new ProfileNode(ProfileFixtures.printf, 1, 1);
    Profile profile = new Profile(2, asList(new FlatProfileEntry(ProfileFixtures.printf, 1, 0, 1)), asList(new FlatProfileEntry(ProfileFixtures.printf, 1, 0, 1)), toTrees(root));
    ui.accept(profile);
    console.isShowingTraces(2);
    console.displaysMethod(ProfileFixtures.printf);
    console.outputContains("100.0");
}
Also used : ProfileNode(com.insightfullogic.honest_profiler.core.profiles.ProfileNode) FlatProfileEntry(com.insightfullogic.honest_profiler.core.collector.FlatProfileEntry) Profile(com.insightfullogic.honest_profiler.core.profiles.Profile) Test(org.junit.Test)

Example 9 with Profile

use of com.insightfullogic.honest_profiler.core.profiles.Profile in project honest-profiler by jvm-profiling-tools.

the class ProfileUpdateModerator method run.

@Override
public void run() {
    try {
        while (true) {
            final Profile profile = incomingProfile.get();
            if (profile != null) {
                listener.accept(profile);
                incomingProfile.compareAndSet(profile, null);
            }
            Thread.sleep(UI_UPDATE_WINDOW_IN_MS);
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : Profile(com.insightfullogic.honest_profiler.core.profiles.Profile)

Aggregations

Profile (com.insightfullogic.honest_profiler.core.profiles.Profile)9 Test (org.junit.Test)5 StackFrame (com.insightfullogic.honest_profiler.core.parser.StackFrame)3 TraceStart (com.insightfullogic.honest_profiler.core.parser.TraceStart)3 FlatProfileEntry (com.insightfullogic.honest_profiler.core.collector.FlatProfileEntry)2 ProfileNode (com.insightfullogic.honest_profiler.core.profiles.ProfileNode)2 MachineListener (com.insightfullogic.honest_profiler.core.MachineListener)1 Method (com.insightfullogic.honest_profiler.core.parser.Method)1 ProfileTree (com.insightfullogic.honest_profiler.core.profiles.ProfileTree)1 VirtualMachine (com.insightfullogic.honest_profiler.core.sources.VirtualMachine)1 FileLogSource (com.insightfullogic.honest_profiler.ports.sources.FileLogSource)1 LocalMachineSource (com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource)1 ArrayDeque (java.util.ArrayDeque)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1