2013年7月18日木曜日

Tomcatのsharedローダのクラスを監視する Java Intaractive Profiler(JIP)の備忘録

最近、プロファイラを利用してアプリの挙動の確認を行った。hprofでなく、JIPを利用しました。
利用したのは現在(2013年7月)のバージョン(1.2)です。

使い方は色々なページで説明していたり、ドキュメントが付属しているのでなんとなく読めばわかりますが、ちょっとわからなかったことを備忘録として書いておきます。

参考:http://d.hatena.ne.jp/goking/20101125/p1


  • Tomcatのアプリと、sharedloaderに指定したライブラリをプロファイルする
どうしても見つけられなかったので、書き残しておきます。

通常、Webアプリのプロファイルをする場合は、プロファイラとしてwebapp.profile.propertiesを指定しますが、こいつを少し編集します。

もともとの内容の一部

#
# Class Loader filters for different runtine environments
# (The system will cycle through these until it finds one that
# can filter in the current environment)
#
ClassLoaderFilter.1=com.mentorgen.tools.profile.instrument.clfilter.WebAppClassLoaderFilter
ClassLoaderFilter.2=com.mentorgen.tools.profile.instrument.clfilter.StandardClassLoaderFilter


 書きなおした結果

#
# Class Loader filters for different runtine environments
# (The system will cycle through these until it finds one that
# can filter in the current environment)
#
ClassLoaderFilter.1=com.mentorgen.tools.profile.instrument.clfilter.TomcatInternalClassLoaderFilter
ClassLoaderFilter.2=com.mentorgen.tools.profile.instrument.clfilter.StandardClassLoaderFilter

 ClassLoaderFilter.1 をTomcatInternalClassLoaderFilterに変えます。これで、sharedloaderのクラスもプロファイル対象となりました。

あとは、excludeの項目に、見たくないパッケージを記載しておけば、ごちゃごちゃしなくなります。

Javaネイティブのクラスをプロファイル対象にできないかどうかは探し中です。
見つかるのかわからないですが....

他にもいくつかプロファイラがありますが、どうやって使うのかはわかりません。
http://www.java2v.com/Open-Source/Java-Document/Profiler/JIP/com.mentorgen.tools.profile.instrument.clfilter.htm

もうひとつついでに。
ダウンロード先のSourceForgeでは、最初あやまってjip-src-1.2.zipをダウンロードしました。
間違ってはいないんですが、JipViewerが見つかりませんでした。
jip-1.2.zipをダウンロードしたらちゃんとありました。

http://sourceforge.net/projects/jiprof/files/jip/1.2/