use of com.insightfullogic.honest_profiler.framework.generator.LeanProfileGenerator in project honest-profiler by jvm-profiling-tools.
the class AggregationProfileTest method checkGlobalAggregation.
@Test
public void checkGlobalAggregation() {
LeanProfileGenerator gen = new LeanProfileGenerator();
SCENARIOS.get(7).executeAndEnd(gen);
AggregationProfile profile = new AggregationProfile(gen.getProfile());
NumericInfo global = profile.getGlobalData();
assertEquals("Global Self Count should be 0", 0, global.getSelfCnt());
assertEquals("Global Total Count wrong", 111, global.getTotalCnt());
assertEquals("Global Self Time should be 0", ZERO, global.getSelfTime());
assertEquals("Global Total Time wrong", valueOf(nano(111)), global.getTotalTime());
}
use of com.insightfullogic.honest_profiler.framework.generator.LeanProfileGenerator in project honest-profiler by jvm-profiling-tools.
the class AggregationProfileTest method checkThreadInfoLogic.
@Test
public void checkThreadInfoLogic() {
LeanProfileGenerator gen = new LeanProfileGenerator();
SCENARIOS.get(7).executeAndEnd(gen);
LeanProfile leanProfile = gen.getProfile();
for (LeanThreadNode threadNode : leanProfile.getThreads().values()) {
assertNull(threadNode.getThreadInfo());
}
AggregationProfile profile = new AggregationProfile(leanProfile);
Map<Long, LeanThreadNode> threads = profile.getSource().getThreads();
// Check ThreadInfo has been updated
assertNotNull("Missing ThreadInfo for thread 1", threads.get(1L).getThreadInfo());
assertNotNull("Missing ThreadInfo for thread 2", threads.get(2L).getThreadInfo());
assertNotNull("Missing ThreadInfo for thread 3", threads.get(3L).getThreadInfo());
assertNotNull("Missing ThreadInfo for thread 4", threads.get(4L).getThreadInfo());
assertNotNull("Missing ThreadInfo for thread 5", threads.get(5L).getThreadInfo());
assertNull("There should be no ThreadInfo for thread 6", threads.get(6L).getThreadInfo());
}
use of com.insightfullogic.honest_profiler.framework.generator.LeanProfileGenerator in project honest-profiler by jvm-profiling-tools.
the class LeanLogCollectorTest method threadInfoHandling.
@Test
public void threadInfoHandling() {
LeanProfileGenerator gen;
// R07, R10
gen = new LeanProfileGenerator(true);
gen.handle(S_01, F_01, M_01, S_02, F_02);
gen.endOfLog();
gen.assertSingleEmission();
gen.assertSingleEmission();
gen.assertThreadMapSizeEquals(0);
// R05
gen = getPrimedGenerator();
gen.handle(T_01);
gen.assertSingleEmission();
gen.assertThreadMapSizeEquals(1);
gen.assertContains(T_01);
// R11 - First ThreadMeta name non-null, Second ThreadMeta name null
gen = getPrimedGenerator();
gen.handle(T_01, thread(1, null));
gen.endOfLog();
gen.assertThreadMapSizeEquals(1);
gen.assertContains(T_01);
// R11 - First ThreadMeta name null, Second ThreadMeta name non-null
gen = getPrimedGenerator();
gen.handle(T_01, thread(1, null));
gen.endOfLog();
gen.assertThreadMapSizeEquals(1);
gen.assertContains(T_01);
// R11 - First ThreadMeta name non-null, Second ThreadMeta name non-null
gen = getPrimedGenerator();
gen.handle(thread(1, "A"), thread(1, "B"));
gen.endOfLog();
gen.assertThreadMapSizeEquals(1);
gen.assertContains(thread(1, "B"));
// R11 - First ThreadMeta name null, Second ThreadMeta name null
gen = getPrimedGenerator();
gen.handle(thread(1, null), thread(1, null));
gen.endOfLog();
gen.assertThreadMapSizeEquals(1);
gen.assertContains(thread(1, null));
// Multiple Methods
gen = getPrimedGenerator();
gen.handle(T_01, T_02, T_03, T_04, T_05);
gen.endOfLog();
gen.assertThreadMapSizeEquals(5);
gen.assertContains(T_01, T_02, T_03, T_04, T_05);
}
use of com.insightfullogic.honest_profiler.framework.generator.LeanProfileGenerator in project honest-profiler by jvm-profiling-tools.
the class LeanLogCollectorTest method getPrimedGenerator.
/**
* Returns a new gen which has processed a trivial stacktrace and for which a profile has been requested. Use this
* to declutter tests.
*
* @return a gen.
*/
private LeanProfileGenerator getPrimedGenerator() {
LeanProfileGenerator gen = new LeanProfileGenerator();
gen.handle(S_01, F_01, S_02);
gen.requestProfile();
return gen;
}
Aggregations