如何在服务器端的Java应用程序上使用Rational PurifyPlu

1.        安装 Rational PurifyPlus 的三个工具( Quantify,pureCoverage,Purify

2.        安装 jdk jre ,配置好你的运行环境

3.        设置 JDK,JRE 环境变量

JAVA_HOME:   C:\j2sdk1.4.2_09

Path:        %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

CLASSPATH:   .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar

 

4.        设置 PurifyPlus 环境变量

    _JAVA_OPTIONS:-XrunPureJVMPI:Purify (or Quantify or Coverage)

5.        为了正确的建立允许使用 PurifyPlus Java 运行环境,建立完一个新的 Java 服务后,在第一次开始成型之前你必须执行以下命令行:在你的 quantify (或 coverage purify )的安装目录下

    
pstart <or qstart, or cstart>/setup 


 例:    

   D:\Program Files\Rational\PurifyPlus>qstart /setup

   D:\Program Files\Rational\PurifyPlus>pstart /setup

   D:\Program Files\Rational\PurifyPlus>cstart /setup

     不论是否成功,这个命令都不会返回结果,如果配置成功,可以在 C:\j2sdk1.4.2_09\jre\lib\security\java.policy 文件的末尾,找到这样一段内容

/* RATIONAL SOFTWARE. BCI grant */

/* DO NOT EDIT BELOW THIS LINE */

grant {

           permission java.lang.RuntimePermission "loadLibrary.QProfJ";

                  permission java.io.FilePermission "C:/j2sdk1.4.2_09/jre/lib/ext/x86/QProfJ.dll", "read";

};

同时你可以在 C:\j2sdk1.4.2_09\jre\lib\ext\X86 文件夹下找到 QProfJ.dll 文件

 

补充说明:在以下三种情况下必须进行这项配置:

(1)       java 应用服务器在 PurifyPlus 之后安装。

(2)       系统默认的 JVM 在安装 PurifyPlus 之后改变了。

(3)       Java 应用服务器没有使用默认的 JVM

  附原文说明(本人 E 文较烂,担心翻译有错)

  This step has to be performed in case the Java application server is installed on the system after PurifyPlus, or if the default JVM for the system is changed after PurifyPlus installation, or if the Java application server doesn't use the default JVM.

 

6.        设置 Profile.ini 文件中的过滤(也可以在 GUI 中设置, GUI 中设置不能在运行时过滤,只是在结果中过滤),可以在结果中减少和自己的方法无关的数据。

主要过滤以下服务器(找到和你的服务器对应的包过滤就可以了),如果你的服务器不属于这几个,过滤掉你服务器对应的包。

注意:每个包后的“ . ”要写,如果不写,只过滤这个包,不过滤他的子包

IBM WebSphere 4

BEA WebLogic 6.1

ApacheJakartaTomcat 4

Sun J2EE SDK1.3.1

Silverstream 3.7

      例:

     Profile.ini文件在你的rational安装目录的公共目录下

     我的是在D:\Program Files\Rational\PurifyPlus下,找到[PreFilters],象下面那样添加要过滤的包名。
[PreFilters]
java.
javax.
sun.
com.sun
org.omg.
org.xml.
org.w3c.
COM.
com.beasys.
com.adventnet.
weblogic.
bea.
com.bea.
antlr.
bsh.
c8e.
dcom.
db.
org.enhydra.
com.fourthpass.
org.apache.
rational.robot.
com.inprise.
com.linar.
com.ibm.
com.caucho.
ibm.
org.eclipse.
org.modzilla.

7.        都设置完了,运行你的服务器,然后对应的 PurifyPlus 工具会自动运行,直到你停掉你的服务器。接下来就可以分析收集到的数据了。

特别说明:

2003.06.00 版本的 PurifyPlus level 级别运行时不支持 eclipse 的类加载器(在他们的文章里我有看见 level 级的数据,所以我考虑换 JB

原文如下:

PurifyPlus does not work with the Eclipse class loader when attempting to collect profiling information at the line level. The error message that will be seen at run time is the following:
java.lang.NoClassDefFoundError: Rational/QProfJ

To circumvent this problem, you must collect profiling information at the function level. This can be done as follows:
For Purify: In Settings>Executable Settings>Power Check, set the Default Profile Level to function.
For PureCoverage: In Settings>Executable Settings>Power Check, set the Default Coverage Level to function.
For Quantify: In Settings>Executable Settings>Power Check, set the Default Measurement Level to function.

 

如果你在运行 Quantify 的时候出现这些错误:

错误:

Exception in thread "main" java.lang.NoClassDefFoundError: Rational/QProfJ

目前看到的解决思路大部分都是把这些包在 ini 文件里过滤掉。还有一种方法是在 Quantify.java 里修改,但是这个方法我看了觉得有问题(主要是觉得这几个语法 java 里都不成立),列出来大家看看。

补充说明,下面这个方法是针对 Solaris 操作系统

可以在这个链接看到原文:

http://www-1.ibm.com/support/docview.wss?uid=swg21118703

 

If you are using2002a.06 or 2003.06, add the following prefilters list to .quantify.java file. You can modify the default .quantify.java file in Quantify home directory, or create a new one in your home directory.

prefilters * java.
prefilters * javax.
prefilters * org.omg.
prefilters * org.xml.
prefilters * org.apache.
prefilters * rational.robot.
prefilters * com.inprise.
prefilters * com.linar.
prefilters * com.ibm.
prefilters * ibm.
prefilters * org.eclipse.
prefilters * org.modzilla.

If you are using2003a.06.00.Proto.0090 or later, instead of excluding third party packages, include only the packages/classes that you are interested in.

For example, to profile only the package "MyCompany", create .quantify.java file with below lines:

classes_to_profile * selective
include * MyCompany.*

 

 

结束了 ~~~

出现过一堆问题,基本都是在 ibm 的网站上找到答案的,而且都是英文,看的好累啊,不过真正解决了也很有成就感哦,呵呵 ~~~

你可能感兴趣的:(java,eclipse,jvm,应用服务器,IBM)