arthas trace

方法内部调用路径,并输出方法路径上的每个节点上耗时

例如针对controller中的一个方法
包名为:com.example.springbatchdemo.demos.web.BasicController
类名:BasicController
方法名: hellp

[arthas@7988]$ trace com.example.springbatchdemo.demos.web.BasicController hello
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 58 ms, listenerId: 13
`---ts=2023-12-18 10:15:31;thread_name=http-nio-8081-exec-4;id=29;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@334ebcaa
    `---[5317.3569ms] com.example.springbatchdemo.demos.web.BasicController:hello()
        `---[99.99% 5316.8505ms ] com.example.springbatchdemo.demos.web.service.TestService:startJobs() #39

可以看到com.example.springbatchdemo.demos.web.service.TestService:startJobs方法耗时99.99%说明是最影响性能的调用。可以针对性测试。

其他示例

[arthas@19280]$ trace com.example.springbatchdemo.demos.web.BasicController test
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 79 ms, listenerId: 1
`---ts=2023-12-18 10:24:39;thread_name=http-nio-8081-exec-1;id=26;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@68ee3b6d
    `---[3027.3895ms] com.example.springbatchdemo.demos.web.BasicController:test()
        +---[0.01% 0.164ms ] com.example.springbatchdemo.demos.web.service.AService:a1() #63
        +---[0.00% 0.0865ms ] com.example.springbatchdemo.demos.web.service.AService:a2() #64
        +---[33.05% 1000.6056ms ] com.example.springbatchdemo.demos.web.service.AService:a3() #65
        +---[0.00% 0.0834ms ] com.example.springbatchdemo.demos.web.service.BService:b1() #66
        +---[33.46% 1012.8767ms ] com.example.springbatchdemo.demos.web.service.BService:b2() #67
        +---[0.00% 0.08ms ] com.example.springbatchdemo.demos.web.service.BService:b3() #68
        +---[33.44% 1012.4839ms ] com.example.springbatchdemo.demos.web.service.CService:c1() #69
        +---[0.00% 0.0371ms ] com.example.springbatchdemo.demos.web.service.CService:c2() #70
        `---[0.00% 0.0238ms ] com.example.springbatchdemo.demos.web.service.CService:c3() #71
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容