[alibaba/arthas]3.6.9版本trace MathGame的Print函数没有下级方法

2024-07-17 774 views
5
环境信息
  • arthas-boot.jar 或者 as.sh 的版本: xxx
  • Arthas 版本: 3.6.9
  • 操作系统版本: centos 7
  • 目标进程的JVM版本: openjdk version "1.8.0_312"
  • 执行arthas-boot的版本: xxx
重现问题的步骤
  1. 下载的3.6.9版本,启动里面的MathGame
  2. trace 里面的demp.MathGame print
期望的结果

What do you expected from the above steps?

实际运行的结果
wiki       https://arthas.aliyun.com/doc                                        
tutorials  https://arthas.aliyun.com/doc/arthas-tutorials.html                  
version    3.6.9                                                                
main_class                                                                      
pid        14958                                                                
time       2023-05-11 14:05:53                                                  

[arthas@14958]$ trace demo.MathGame print
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 194 ms, listenerId: 1
`---ts=2023-05-11 14:06:12;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[0.680768ms] demo.MathGame:print()

`---ts=2023-05-11 14:06:13;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[0.435911ms] demo.MathGame:print()

`---ts=2023-05-11 14:06:15;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[0.499324ms] demo.MathGame:print()

`---ts=2023-05-11 14:06:18;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[1.250996ms] demo.MathGame:print()

回答

4

是我使用姿势不对吗,demo.MathGame run是可以的

wiki       https://arthas.aliyun.com/doc                                        
tutorials  https://arthas.aliyun.com/doc/arthas-tutorials.html                  
version    3.6.9                                                                
main_class                                                                      
pid        15768                                                                
time       2023-05-11 14:12:32                                                  

[arthas@15768]$ trace demo.MathGame run
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 207 ms, listenerId: 1
`---ts=2023-05-11 14:12:45;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[1.150462ms] demo.MathGame:run()
        `---[11.99% 0.137997ms ] demo.MathGame:primeFactors() #24 [throws Exception]

`---ts=2023-05-11 14:12:46;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@70dea4e
    `---[1.451833ms] demo.MathGame:run()
        +---[54.40% 0.789762ms ] demo.MathGame:primeFactors() #24
        `---[28.08% 0.40772ms ] demo.MathGame:print() #25
0

默认JDK的方法是不增强的,可能demo.MathGame:print()方法里都是JDK方法?

8

应该不是吧,子方法增强,只增强目标函数的目标方法,应该是不管里面调用的是谁

4

trace demo.MathGame print --skipJDKMethod false 。 因为 jdk 自身的函数太多了,如果都打印出来,很多时候结果非常长。

4

感谢...