I'm working on the new microkernel and now I have an example how it
works at the moment. Please let me know your insight about it:
@Test
public void testRandom01() throws Exception {
// create a thread sampler that dumps its sampling in the queue 'c'
in every 100 millis
TimerUtils.get().registerTimer("continuum", "sampling/thread",
"queue=c;millis=100");
// start the sampler in daemon mode
TimerUtils.get().start("continuum", true);
// do the application specific tests
doTest(init(10), 10, 100);
doTest(init(20), 10, 100);
doTest(init(1000), 10, 1000);
// stop the timer
TimerUtils.get().stop("continuum");
// create an analyzer that only counts the stack trace elements
CounterThreadAnalyzer cta = new CounterThreadAnalyzer();
// feed the analyzer from the queue
cta.drainQueue("c");
// print the tree, but only the items that occured at least two times
cta.print(2);
}
The TimerUtils is responsible for the thread handling. There is a
similar utils for handling JMX connections seprately. This way e.g.
you setup the JMX connection first with a one-liner, than you pass the
connect's name in the config of the timer. Let me know what you think
about it.
Regards,
Istvan