public aspect MonitorAspect { pointcut monitor() : execution(* *.ClassToMonitor.methodToMonitor(..)); Object arround() : monitor() { Monitor monitor = MonitorFactory.start(thisJoinPoint.toShortString()); Object returnedObject = proceed(); monitor.stop(); return returnedObject; } }
/** * Wraps the invocation with a JAMon Monitor and writes the current * performance statistics to the log (if enabled). * @see com.jamonapi.MonitorFactory#start * @see com.jamonapi.Monitor#stop */ @Override protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { String name = createInvocationTraceName(invocation); MonKey key = new MonKeyImp(name, name, "ms."); Monitor monitor = MonitorFactory.start(key); try { return invocation.proceed(); } catch (Throwable ex) { trackException(key, ex); throw ex; } finally { monitor.stop(); if (!this.trackAllInvocations || isLogEnabled(logger)) { writeToLog(logger, "JAMon performance statistics for method [" + name + "]:\n" + monitor); } } }
/** * Stop. * * @see com.jamonapi.Monitor#stop() */ public void stop() { monitor.stop(); }
public Monitor stop() { for (int i=0;i<numRows;i++) monitors[i].stop(); return this; }
@Override public void stop(Monitor mon) { mon.stop(); }
/** * Start the monitor. */ public void stop() { if(this.isActive) { this.monitor.stop(); } }
/** * Stop. * * @see com.jamonapi.Monitor#stop() */ @Override public void stop() { monitor.stop(); }
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(MonitorFactory.getMonitor("Point 1").toString()); System.out.println(MonitorFactory.getMonitor("Point 2").toString());
public void factoryMonitor() throws Exception { System.out.println("\nFull Factory TimingMonitor()- uses cached version so doesn't create child monitors"); System.out.println("\tMonitor mon=MonitorFactory.start('pages.admin');"); System.out.println("\tmon.stop();"); for (int i=0; i<testIterations; i++) { testMon=MonitorFactory.start("pages.admin"); testMon.stop(); } System.out.println(testMon); }
/** * 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 void factoryMonitor() throws Exception { System.out.println("\nFull Factory TimingMonitor()- uses cached version so doesn't create child monitors"); System.out.println("\tMonitor mon=MonitorFactory.start('pages.admin');"); System.out.println("\tmon.stop();"); for (int i=0; i<testIterations; i++) { testMon=MonitorFactory.start("pages.admin"); testMon.stop(); } System.out.println(testMon); }
/** * 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(); } }
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { String name = createInvocationTraceName(invocation); Monitor monitor = MonitorFactory.start(name); try { return invocation.proceed(); } finally { monitor.stop(); logger.trace("JAMon performance statistics for method [" + name + "]:\n" + monitor); } }
public String getQuestion(QueryTree<N> lgg, List<QueryTree<N>> negTrees, List<String> knownResources) throws TimeOutException{ // return computeQuestionOptimized(lgg, negTrees, knownResources); mon.start(); String question = computeQuestionBetterPerformance(lgg, negTrees, knownResources); mon.stop(); return question; }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { Monitor allPages = MonitorFactory.start(new MonKeyImp("com.jamonapi.allPages",getURI(request),"ms.")); Monitor monitor = MonitorFactory.start(getURI(request)); try { filterChain.doFilter(request, response); } finally { monitor.stop(); allPages.stop(); } }
@Override public void stop(Monitor mon, Throwable throwable) { mon.stop(); put(throwable); // note the following 'get' always succeeds because of the above 'put' mon.getMonKey().setDetails(get(throwable)); }
@Override public void stop(Monitor mon, Throwable throwable) { mon.stop(); put(throwable); // note the following 'get' always succeeds because of the above 'put' mon.getMonKey().setDetails(get(throwable)); }
@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); }