How to insert response size and time into the page itself, at least partially?

前端 未结 3 1381
抹茶落季
抹茶落季 2020-12-02 21:41

I realize it\'s a chicken and egg problem and that it\'s not possible to accurately resolve the time it took to render a page (or the size of response) and insert that numbe

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 22:20

    I wrote a blog post explaining how you could create an Interceptor that would measure each method call your seam compontents where using.

    You can find the blog post here. You need to scroll down to the second part.

    Basically, all you need to do is annotate the method you want to measure with @MeasureCalls and it will automatically be picked up by the interceptor

    @Name("fooBean")
    @MeasureCalls
    public class FooBean
    

    An output would be something like this, showing the time it took in milliseconds and how many times each method was called:

    284.94 ms   1   FooBean.getRandomDroplets()
    284.56 ms   1   GahBean.getRandomDroplets()
    201.60 ms   2   SohBean.searchRatedDoodlesWithinHead()
    185.94 ms   1   FroBean.doSearchPopular()
    157.63 ms   1   FroBean.doSearchRecent()
     42.34 ms   1   FooBean.fetchMostRecentYodel()
     41.94 ms   1   GahBean.getMostRecentYodel()
     15.89 ms   1   FooBean.getNoOfYodels()
     15.00 ms   1   GahBean.getNoOfYodels()
      9.14 ms   1   SohBean.mainYodels()
      1.11 ms   2   SohBean.trackHoorayEvent()
      0.32 ms   1   FroBean.reset()
      0.22 ms  43   NohBean.thumbPicture()
      0.03 ms  18   FooBean.getMostRecentYodels()
      0.01 ms   1   NohBean.profilePicture()
      0.01 ms   1   FroBean.setToDefault()
      0.01 ms   1   FroBean.getRecentMarker() 
    

提交回复
热议问题