If an error happens in out system, the monitored code is much faster. That messes up our stats.
Is it save -not- to call Monitor.stop on error?
It is safe in that no memory resources will be consumed or lost. jamon however tracks the number of active monitors of the current type though. This number is decremented at stop time and so won't be decremented properly.
One other way to keep stats only when there is no error using add.
For example instead of start you could do this (i may not be calling the right method names as I am doing it from memory.
If there is no error then do this.
MonitorFactory.add("label", "ms.", endtime-startTime);
You could hide this logic in your own monitor class.
Also instead of calling System.timeInMillis() directly you could call.
and in case of no error call
// don't recall if stop is required to be called or not.
MonitorFactory.add("label", "ms.", mon.getAvg());
There will be a mon.skip() in the next version to solve this problem.
JAMon 2.71 was released today with this fix in it.
JAMon 2.71 is a minor release that adds a few features that users requested after version 2.7 (Thanks for patiently waiting!). JAMon still requires JDK 1.4 or higher (with a couple exceptions referenced below). If version 2.7 is working for you and you don't want the features below then this is not a required upgrade. To use 2.71 you must install the new jar (jamon-2.71.jar), and if you are using using JAMon war to view the JAMon stats then you must also install the new war.
See this link for more information: http://jamonapi.sourceforge.net/jamon271.html
To download: https://sourceforge.net/projects/jamonapi/files/
Log in to post a comment.