放学习资料的地方~~~~会有转帖,也会有原创,希望在帮到我的时候也能帮到大家~~~

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

上一篇 / 下一篇  2007-08-21 17:38:43 / 个人分类:学习进行时~~~~

呵呵呵呵~~~~生平第一篇技术文章,很多资料都是英文的,看的郁闷,所以整理翻译出来了,有错的地方大家多多包涵哈~~~~这些配置对三个工具是通用的,但是我暂时只用了Quantify,以后用另外两个工具的时候遇到问题会继续发出来。

 

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

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

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.      为了正确的建立允许使用PurifyPlusJava运行环境,建立完一个新的Java服务后,在第一次开始成型之前你必须执行以下命令行:在你的quantify(或coveragepurify)的安装目录下

  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版本的PurifyPluslevel级别运行时不支持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的网站上找到答案的,而且都是英文,看的好累啊,不过真正解决了也很有成就感哦,呵呵~~~

 


TAG:

 

评分:0

我来说两句

Open Toolbar