/** * Adds the. * * @param arg0 * argument * @see com.jamonapi.Monitor#add(double) */ @Override public void add(final double arg0) { monitor.add(arg0); }
JAMonBufferListener jbl=new JAMonBufferListener(); delme.addListener("max", jbl); MonitorFactory.getMonitor("/jamon/jamonadmin.jsp","ms.").add(100); jbl=(JAMonBufferListener)MonitorFactory.getMonitor("/jamon/jamonadmin.jsp","ms.").getListenerType("max").getListener(); Object[][] data=jbl.getDetailData().getData();
/** * @param arg0 * @see com.jamonapi.Monitor#add(double) */ public void add(double arg0) { monitor.add(arg0); }
public Monitor add(double value) { for (int i=0;i<numRows;i++) monitors[i].add(value); return this; }
@Override public Monitor add(double value) { for (int i=0;i<numRows;i++) monitors[i].add(value); return this; }
System.out.println("***** Class unit tests"); System.out.println("\nMonitorFactory.main()"); MonitorFactory.main(null); System.out.println("\nTestClassPerformance.main()"); TestClassPerformance.main(args); Monitor timingMon; System.out.println("\n***** MonitorFactory.getData():"); Monitor m1=MonitorFactory.start("pages.purchase.test"); Monitor m2=MonitorFactory.start("steve.souza.test"); Thread.sleep(350); m1.stop(); Thread.sleep(650); m2.stop(); Object[][] rows=MonitorFactory.getData(); for (int i=0; i<rows.length; i++) { String rowData="row"+i+"=["; for (int j=0; j<rows[0].length; j++) { rowData+=rows[i][j]+", "; } System.out.println(rowData+"]"); } System.out.println("\n***** Multi-threaded test"); long LOBIT=0x00000001;//1 long HIBIT=0x10000000;//268,435,456 timingMon=MonitorFactory.start(); ThreadGroup threadGroup=new ThreadGroup("threadGroup"); //Note mon1 is shared by all instances of the thread and so will test concurrent access. Monitor mon1=MonitorFactory.getTimeMonitor("mon1"); for (int i=0; i<THREADS; i++) // mon1 should be THREADS*1 new Thread(threadGroup, new TestClass(i, LOBIT, LOBIT, mon1)).start(); Monitor mon2=MonitorFactory.getTimeMonitor("mon2"); for (int i=0; i<THREADS; i++)//THREADS*HIBIT new Thread(threadGroup, new TestClass(i, HIBIT, HIBIT, mon2)).start(); Monitor mon3=MonitorFactory.getTimeMonitor("mon3"); for (int i=0; i<THREADS; i++) //(THREADS/2)*LOBIT + (THREADS/2)*HIBIT new Thread(threadGroup, new TestClass(i, LOBIT, HIBIT, mon3)).start(); while(threadGroup.activeCount()!=0) ; System.out.println("Threads have finished processing. It took "+timingMon.stop()); System.out.println("Total should equal "+THREADS+" - "+mon1); System.out.println("Total should equal "+THREADS*HIBIT+" - "+mon2); double threadCount=THREADS/2; System.out.println("Total should equal "+(threadCount*LOBIT + threadCount*HIBIT) +" - "+mon3); Monitor mon4=MonitorFactory.start("mon4"); System.out.println("\nStarting mon4 thread test"); Monitor mon4ThreadTest=MonitorFactory.start(); threadGroup=new ThreadGroup("timingMonitorThreads"); for (int i=0; i<THREADS; i++) new Thread(threadGroup, new TimingMonitorThreads(mon4)).start(); while(threadGroup.activeCount()!=0) ;
/** * Stop the monitor */ public void stop(Throwable throwable) { if(this.isActive) { // use a negative execution time to mark an exception for an affiliate this.monitor.add(-1); this.monitor.stop(); } }
public Monitor add(MonKey key, double value) { return getMonitor(key).add(value); }
/** * Stop the monitor */ public void stop() { if(this.isActive) { long duration = System.currentTimeMillis() - this.startTime; this.monitor.add(duration); this.monitor.stop(); } }
/** * Stop the monitor */ public void stop() { if(this.isActive) { long duration = System.currentTimeMillis() - this.startTime; this.monitor.add(duration); this.monitor.stop(); } }
/** * Stop the monitor */ public void stop(Throwable throwable) { if(this.isActive) { // use a negative execution time to mark an exception for an affiliate this.monitor.add(-1); this.monitor.stop(); } }
public Monitor add(MonKey key, double value) { return getMonitor(key).add(value); }
/** * Run the code in a new thread after a delay * * @param invocation * The code to run * @param millis * The time to wait before, in milliseconds * @return The future object, to know when the task is completed */ public static Future<?> invoke(Invocation invocation, long millis) { Monitor monitor = MonitorFactory.getMonitor("Invocation queue", "elmts."); monitor.add(executor.getQueue().size()); return executor.schedule(invocation, millis, TimeUnit.MILLISECONDS); }
public Monitor add(String label, String units, double value) { return getMonitor(new MonKeyImp(label, units)).add(value); }
public Monitor add(String label, String units, double value) { return getMonitor(new MonKeyImp(label, units)).add(value); }
/** * Run the code in a new thread took from a thread pool. * * @param invocation * The code to run * @return The future object, to know when the task is completed */ public static Future<?> invoke(Invocation invocation) { Monitor monitor = MonitorFactory.getMonitor("Invoker queue size", "elmts."); monitor.add(executor.getQueue().size()); invocation.waitInQueue = MonitorFactory.start("Waiting for execution"); return executor.submit(invocation); }
public void add(MonKeyImp monkey, int index, double value) { try { get(monkey).getMonitors()[index].add(value); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); logger.error("index too big, is: "+index+" max = " + get(monkey).getMonitors().length); } }
@Override void stopTimeMon(HttpMonRequest httpMonBase) { if (httpMonBase.getRequest() instanceof Request) { Request request=(Request)httpMonBase.getRequest(); Monitor mon=httpMonBase.getNextTimeMon(); if (mon!=null) { mon.add(System.currentTimeMillis()-request.getTimeStamp()).stop();// figure elapsed time and then decrement active. } } else super.stopTimeMon(httpMonBase); }
JAMonBufferListener jbl=new JAMonBufferListener(); delme.getListenerType("max").addListener(jbl); MonitorFactory.getMonitor("/jamon/jamonadmin.jsp","ms.").add(100); jbl=(JAMonBufferListener)MonitorFactory.getMonitor("/jamon/jamonadmin.jsp","ms.").getListenerType("max").getListener(); Object[][] data=jbl.getData();