Java Code Examples for org.aspectj.lang.Signature#toShortString()
The following examples show how to use
org.aspectj.lang.Signature#toShortString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PerformanceMonitor.java From springboot-seed with MIT License | 6 votes |
/** * Monitor the elapsed time of method on controller layer, in * order to detect performance problems as soon as possible. * If elapsed time > 1 s, log it as an error. Otherwise, log it * as an info. */ @Around("controllerLayer()") public Object monitorElapsedTime(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { // Timing the method in controller layer StopWatch stopWatch = new StopWatch(); stopWatch.start(); Object result = proceedingJoinPoint.proceed(); stopWatch.stop(); // Log the elapsed time double elapsedTime = stopWatch.getTime() / 1000.0; Signature signature = proceedingJoinPoint.getSignature(); String infoString = "[" + signature.toShortString() + "][Elapsed time: " + elapsedTime + " s]"; if (elapsedTime > 1) { log.error(infoString + "[Note that it's time consuming!]"); } else { log.info(infoString); } // Return the result return result; }
Example 2
Source File: PerformanceAop.java From android-performance with MIT License | 5 votes |
@Around("call(* com.optimize.performance.PerformanceApp.**(..))") public void getTime(ProceedingJoinPoint joinPoint) { // 签名 Signature signature = joinPoint.getSignature(); String name = signature.toShortString(); long time = System.currentTimeMillis(); try { joinPoint.proceed(); } catch (Throwable throwable) { throwable.printStackTrace(); } // LogUtils.i(name + " cost " + (System.currentTimeMillis() - time)); }
Example 3
Source File: PerformanceAop.java From android-performance with MIT License | 5 votes |
@Around("execution(* android.app.Activity.setContentView(..))") public void getSetContentViewTime(ProceedingJoinPoint joinPoint) { Signature signature = joinPoint.getSignature(); String name = signature.toShortString(); long time = System.currentTimeMillis(); try { joinPoint.proceed(); } catch (Throwable throwable) { throwable.printStackTrace(); } LogUtils.i(name + " cost " + (System.currentTimeMillis() - time)); }
Example 4
Source File: PerformanceAop.java From Awesome-WanAndroid with Apache License 2.0 | 5 votes |
@Around("execution(* android.app.Activity.setContentView(..))") public void getSetContentViewTime(ProceedingJoinPoint joinPoint) { Signature signature = joinPoint.getSignature(); String name = signature.toShortString(); long time = System.currentTimeMillis(); try { joinPoint.proceed(); } catch (Throwable throwable) { throwable.printStackTrace(); } LogHelper.i(name + " cost " + (System.currentTimeMillis() - time)); }
Example 5
Source File: RMIMethodMonitor.java From tlaplus with MIT License | 5 votes |
/** * @param joinPoint Counts the invocation for the given joinPoint */ public static synchronized void entering(JoinPoint joinPoint) { final Signature signature = joinPoint.getSignature(); final String methodName = signature.toShortString(); Integer invocedTimes = invoctions.get(methodName); if(invocedTimes == null) { invoctions.put(methodName, 1); } else { int i = invocedTimes.intValue(); invoctions.put(methodName, ++i); } }