派生自 projectDept/qhighschool

yn147
2023-11-23 bccada7cbf7eea3c37c0243d95426d1a29d9121f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.qxueyou.scc.base.handler;
 
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
 
@Order(80)
@Aspect
@Component
public class PerformanceMonitor {
    
    private static final Logger logger = LogManager.getLogger("PerformanceMonitor");  
 
    @Pointcut("execution(* com.iqtogether.qxueyou..*Service.*(..))")  
    public void pointCutMethod() {  
    }  
    
    @Around("pointCutMethod()")    
    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
        long begin = System.currentTimeMillis();  
        Object o = pjp.proceed();
        long end = System.currentTimeMillis();
        logger.debug("{}:{}",pjp.getTarget().getClass()+"."+pjp.getSignature().getName(),(end-begin));  
        return o;    
    }  
}