Java profiling - how can I get a method by method analysis of my application?

后端 未结 7 1275
挽巷
挽巷 2020-12-29 03:01

I want to run my Java app and for a given workload be able to see:

  • how many times a given function was called
  • how expensive each function call is in
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 03:41

    Exactly this is where AOP helps. Aspects can be added/removed without changing code. If you are using Spring; create Aspect including JoinPoint, Advice listing the Classes and public methods that are to evaluate execution time. Add these beans to the Spring config. Else use AspectJ Container for non-spring application

提交回复
热议问题