淘宝的TProfile分析

TProfile是一个用来抓取性能数据的工具。大概是去年的时候对其分析了一下,并将它改造成了用于分析学习开源产品时的一个trace工具(不是很完善,自己用够用)。现在将之前的笔记翻出来,记录一下。

1. 需要入口

com.taobao.profile.Main.premain(String, Instrumentation)

2. 指定Premain class

<Premain-Class>com.taobao.profile.Main</Premain-Class>

3. premain方法的Instrumentation参数可以指定 class转换器实例

TProfiler用的是com.taobao.profile.instrument.ProfTransformer.ProfTransformer()

4. 自定义的agent依赖的jar包怎么处理

The dependent classes should be part of the jar, which can be created by maven assembly plugin
http://stackoverflow.com/questions/15872642/how-to-put-classes-for-javaagent-in-the-classpath
意思是说要将依赖的jar打包到agentjar里面去

原文地址:https://www.cnblogs.com/simoncook/p/7955277.html