Is it possible to monitor different processing steps using the same JAMon Monitor class? For example, in the code example I would like to measure execution time of "Point1" and "Point2". However, the example returns only statistics about the second step. Of course I can create several objects of type Monitor. But maybe there is a cleaner way?
Monitor mon = null;
for(int i =0; i < 1000; i++){
//Part1
mon = MonitorFactory.start("Point 1");
Thread.sleep(2);
mon.stop();
//Part2
mon = MonitorFactory.start("Point 2");
mon.stop();
}
System.out.println(mon.toString());
Output:
JAMon Label=Point 2, Units=ms.: (LastValue=0.0, Hits=1000.0, Avg=0.001, Total=1.0, Min=0.0, Max=1.0, Active=0.0, Avg Active=1.0, Max Active=1.0, First Access=Wed Jun 17 10:40:44 CEST 2015, Last Access=Wed Jun 17 10:40:46 CEST 2015)
Desired Output:
JAMon Label=Point 1, Units=ms.: (LastValue=0.0, Hits=1000.0, Avg=0.001, Total=1.0, Min=0.0, Max=1.0, Active=0.0, Avg Active=1.0, Max Active=1.0, First Access=Wed Jun 17 10:40:44 CEST 2015, Last Access=Wed Jun 17 10:40:46 CEST 2015)
JAMon Label=Point 2, Units=ms.: (LastValue=0.0, Hits=1000.0, Avg=0.001, Total=1.0, Min=0.0, Max=1.0, Active=0.0, Avg Active=1.0, Max Active=1.0, First Access=Wed Jun 17 10:40:44 CEST 2015, Last Access=Wed Jun 17 10:40:46 CEST 2015)