use of com.insightfullogic.honest_profiler.core.parser.StackFrame in project honest-profiler by jvm-profiling-tools.
the class LogCollectorTest method logCollectorShouldCopeWithUnexpectedFrames.
@Test
public void logCollectorShouldCopeWithUnexpectedFrames() {
final Deque<Profile> found = new ArrayDeque<>();
final LogCollector collector = new LogCollector(found::add, true);
for (int i = 0; i < 10; i++) {
collector.handle(new Method(i, "a", "Bass", "c" + i));
}
assertTrue("methods don't cause profiles", found.isEmpty());
int threadId = 0;
collector.handle(new TraceStart(2, ++threadId, 1, 1));
assertTrue("nothing to profile still", found.isEmpty());
collector.handle(new StackFrame(LINE, 0));
collector.handle(new StackFrame(LINE, 1));
// ..and one unexpected frame
collector.handle(new StackFrame(LINE, 2));
// normal method afterwards
collector.handle(new TraceStart(2, ++threadId, 1, 1));
collector.handle(new StackFrame(LINE, 6));
collector.handle(new StackFrame(LINE, 7));
// and continuation
collector.handle(new TraceStart(20, ++threadId, 1, 1));
assertArrayEquals(new long[] { 2, 7 }, idOfLastMethodInEachThread(found.getLast()));
}
use of com.insightfullogic.honest_profiler.core.parser.StackFrame in project honest-profiler by jvm-profiling-tools.
the class AggregationUtil method keysFor.
// -> List of parents identifying a Tree node in a Tree with Thread root nodes
public static final String[] keysFor(ThreadGrouping threadGrouping, FrameGrouping frameGrouping, ThreadMeta thread, StackFrame... frames) {
String[] result = new String[frames.length + 1];
result[0] = keyFor(threadGrouping, thread);
int idx = 1;
for (StackFrame frame : frames) {
result[idx++] = keyFor(frameGrouping, frame);
}
return result;
}
use of com.insightfullogic.honest_profiler.core.parser.StackFrame in project honest-profiler by jvm-profiling-tools.
the class AggregationUtil method keysFor.
// -> List of parents identifying a Tree node in a Tree with non-Thread root nodes
public static final String[] keysFor(FrameGrouping frameGrouping, StackFrame... frames) {
String[] result = new String[frames.length];
int idx = 0;
for (StackFrame frame : frames) {
result[idx++] = keyFor(frameGrouping, frame);
}
return result;
}
use of com.insightfullogic.honest_profiler.core.parser.StackFrame in project honest-profiler by jvm-profiling-tools.
the class FlatProfileTest method calculateMajorityFlatProfiles.
@Test
public void calculateMajorityFlatProfiles() {
TraceStart startTrace = new TraceStart(1, 1, 1, 1);
collector.handle(startTrace);
collector.handle(new StackFrame(20, 5));
collector.handle(ProfileFixtures.println);
collector.handle(startTrace);
collector.handle(new StackFrame(20, 5));
collector.handle(startTrace);
collector.handle(new StackFrame(25, 6));
collector.handle(ProfileFixtures.append);
collector.endOfLog();
Profile profile = listener.getProfile();
assertEquals(3, profile.getTraceCount());
assertEquals(2L, profile.flatByMethodProfile().count());
assertEntry(ProfileFixtures.println, 2.0 / 3, profile.flatByMethodProfile().findFirst());
assertEntry(ProfileFixtures.append, 1.0 / 3, profile.flatByMethodProfile().filter(e -> e.getTotalTimeShare() < 0.5).findFirst());
}
use of com.insightfullogic.honest_profiler.core.parser.StackFrame in project honest-profiler by jvm-profiling-tools.
the class FlatProfileTest method looksUpMethodNames.
@Test
public void looksUpMethodNames() {
collector.handle(new TraceStart(1, 1, 1, 1));
collector.handle(new StackFrame(20, 5));
collector.handle(ProfileFixtures.println);
collector.endOfLog();
Profile profile = listener.getProfile();
assertEquals(1, profile.getTraceCount());
assertEquals(1L, profile.flatByMethodProfile().count());
assertEntry(ProfileFixtures.println, 1.0, profile.flatByMethodProfile().findFirst());
}
Aggregations