优雅获取方法耗时

76 阅读1分钟

常规方式

手动在方法前后埋点

long time=System.currentTimeMillis();
long cost=System.currentTimeMillis()-time;

侵入性强

工作量大

AOP

AOP介绍

Aspect Oriented Programming ,面向切面编程

针对同一类问题的统一处理

无侵入添加代码

AspectJ 使用

github.com/HujiangTech…

www.jianshu.com/p/5c9f1e889…