If what you want to monitor is the execution of methods, you can do that using Spring or EJB/CDI or simple java interfaces.
The results will be displayed in the statistics of the reports.
Or if what you want to monitor is just the execution of some pieces of codes, you can create methods and monitor them. For example:
Runnable runnable = new Runnable() {
@Override
public void run() {
// your piece of code
}
};
runnable = MonitoringProxy.createProxy(runnable, "name you want in the statistics");
runnable.run();
And to make the monitoring of pieces of code simpler, I have just added a new simple API in javamelody and so you could do now:
try (Stopwatch stopwatch = new Stopwatch("name you want in the statistics")) {
// your piece of code
}
The results will also be displayed in the statistics of the reports.
For that last one, you will need a snapshot build to be released in 1.77.