Running Optimizeit from the command line

发表于:2007-4-17 18:33

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:不详    来源:转载

 本章节将介绍如何通过命令行(非用户界面)启动、运行和配置Optimizeit。这样你不仅可以通过Optimizeit来运行被测试的程序,你也可以从命令行来启动。

从非Optimizeit用户界面打开应用程序需要做以下工作

  • 设置环境变量
  • 把应用程序作为脚本的一部分来运行
  • 在一台机器上运行被测试程序

 

Starting from the command line

要从命令行启动测试程序,首先:

  • 配置Optimizeit的代理。
  • 启动Optimizeit,指定被测试程序
  • 启动Optimizeit工具连接代理

下面我们来详细描述这些步骤。

配置代理

为了使用代理,你需要修改你环境变量使Optimizeit的库文件路径包含在CLASSPATH中。

Windows操作系统上进行如下设置:

1.    打开Optimizeit的安装目录,本例中假设该目录是<OptItDir>。

2.    打开一个DOS窗口。

3.    设置PATH包含Optimizeit库目录:

set PATH=<OptItDir>\lib;%PATH%

4.    设置CLASSPATH包含Optimizeit optit.jar文件:

set CLASSPATH=<OptItDir>\lib\optit.jar;%CLASSPATH%

UNIX操作系统上,

1.    打开到Optimizeit安装目录。本例中假设该目录为<OptItDir>。

2.    打开一个终端窗口。

3.    设置LD_LIBRARY_PATH包含Optimizeit库文件目录:

export LD_LIBRARY_PATH=<OptItDir>/lib:$LD_LIBRARY_PATH

4.    设置CLASSPATH包含Optimizeit optit.jar文件:

export CLASSPATH=<OptItDir>/lib/optit.jar:$CLASSPATH

Launching your program


启动被测试程序

Optimizeit代理系统也是一系列的类文件和本地代码。可以通过两种方法来启动代理:使用命令或者作为一个命令参数。

  • 使用参数选项来启动代理,请使用下面的参数:

-Xrunpri:startAudit=t

或者

-Xrunpri -Xbootclasspath/a:<OptItdir>\lib\oibcp.jar intuitive.audit.Audit

使用以上任何一种都行。第一种方式允许Optimizeit使用冒号直接运行-Xrun 参数。你可以增加多个参数,并使用冒号分隔。第二种方式包含-Xbootclasspath,因为-Xbootclasspath是启动虚拟机的参数。在Optimizeit的命令行中,虚拟机的参数必须位于Optimizeit参数的前面,除非Optimizeit的参数被放到-Xrun参数的后面。

  • 可以通过如下命令行来使代理作为独立的进程启动:

Windows上:java intuitive.audit.Audit

UNIX上 :java intuitive.audit.Audit

注意:只能在命令行窗口中使用这些参数。如果命令行中包含startAudit=t和intuitive.audit.Audit,系统就会返回一个错误信息提示代理已启动或端口已被占用。

如果把代理作为一个独立的进程启动,Optimizeit会返回代理启动的参数列表。 输出的具体内容跟你的操作系统和JDK版本有关。下面的表格中列出了所有可用的参数。

Windows操作系统上代理的参数

下表列出了Windows平台上Optimizeit代理的启动参数。这些参数分为两类: 虚拟机的和Optimizeit。虚拟机的参数应该在intuitive.audit.Audit命令行的前面, Optimizeit代理的参数跟在后面。

注意:有些参数只能在响应版本的JDK下可用。

Windows audit system Virtual Machine start options

Option

Description

-classic

JDK 1.2 and 1.3 only. Forces Classic runtime.

-hotspot

JDK 1.3.1 and 1.4/Hotspot only.

-Xrunpri

JDK 1.2 and newer only. Starts the Optimizeit Profiler JVMPI agent. You must also add a filter file specification as shown in the examples below.

-Xrunoii

Starts the Optimizeit Suite JVMPI agent. This option is only available if you have Optimizeit Suite installed. All Optimizeit command options, including those that are tool-specific, can be used with -Xrunoii.

-Xbootclasspath
  /a:<OptItdir>\lib\oibcp.jar

JDK 1.2 and newer only. Appends Optimizeit classes to the boot classes. Replace <OptItdir> with the directory where you installed Optimizeit.

-Djava.compiler=NONE

JDK 1.2 only. This option disables the JIT, which is required for JDK version 1.2.

-Xnoclassgc (JDK 1.2 only)

With early Java versions, the Optimizeit Profiler audit system must have class garbage collection disabled. Always use the -Xnoclassgc JVM argument when starting an application from the command line.

Windows audit system Optimizeit start options

Option

Description

[-startAudit]
    [-intuitive.audit.Audit]

Starts the Optimizeit audit system. startAudit=t or intuitive.audit.Audit is required in a command.

[-port portNumber]

Specifies the port you want to use for the communication link between the Optimizeit audit system and the Optimizeit user interface.

[-pause]

Makes the launched program pause immediately after launch. If set to t, the virtual machine waits for the Optimizeit tool to attach to the tested program before starting it. The default setting is f.

[-wait]

Makes the virtual machine wait for Optimizeit Profiler to attach to the tested program before starting it.

[-dmp]

Disables the Memory Profiler. This option is for JDK 1.3.1 and greater.

Note:When testing with Hotspot, use -Xrunpri:dmp=1 to disable the Memory Profiler. This improves performance.

[-directi]

Uses direct instrumentation. By default, Optimizeit Profiler enables direct instrumentation on supported VMs (JDK 1.4.x). Use directi=t to force Optimizeit to use direct instrumentation (the default) or enter directi=f to turn off direct instrumentation.

[-noexit]

Disables the System.exit() method in the virtual machine. This prevents the tested application from exiting the virtual machine. The default is f.

[-filter]

Specifies the filter file that Optimizeit will use for this test. The format of the filter specification is filter=<filter>, where <filter> is the name of (and path to) a filter (.oif) file. Filter specifications are required.

[-enableAPI]

Enables the audit system API. When the API is enabled, the Optimizeit tools are disabled. The audit system waits for the test program to enable the Optimizeit tool from Java.

[-auditOption]

Specifies audit system options that are listed in an ASCII file. The format of the file specification is auditOption=<filename>, where <filename> is the complete path to file containing the audit system options. This file can contain all the Optimizeit audit system options. Only one option is allowed per line. The same option file may be used for different tests.

Note:When this option is used, OISelector settings are overridden.

[ClassName]

The main class for the test program. If the test program is an applet, use sun.applet.AppletViewer and then add the path of the applet HTML file or URL.

Note:With Code Coverage, you must use oldjava instead of java to run an applet.

[-startCPUprofiler     [:<CPUProfilerOptions>]]

Starts the CPU Profiler just before executing the main method. This Optimizeit start option cannot be appended to the -Xrun command with a colon. It must be specified separately.

[-offlineprofiling
    [:<offlineprofilingOptions>]]

Starts the testing in offline mode. Snapshots are generated automatically at a given time. This Optimizeit start option cannot be appended to the -Xrun command with a colon. It must be specified separately.

See also

UNIX audit system options

The following tables list all the audit system invocation options on UNIX platforms. There are two types of start command options: Virtual Machine and Optimizeit. The VM options go before the intuitive.audit.Audit specification in a command, and the Optimizeit options follow the audit system invocation.

Note:Some command options are only available on specific versions of JDK.

UNIX audit system Virtual Machine start options


Option

Description

-classic

JDK 1.2 and 1.3 only. Forces Classic runtime.

-Xrunpri

JDK 1.2 and newer only. Starts the Optimizeit Profiler JVMPI agent. You must also add a filter file specification as shown in the examples below.

-Xrunoii

Starts the Optimizeit Suite JVMPI agent. This option is only available if you have Optimizeit Suite installed. All Optimizeit command options, including those that are tool-specific, can be used with -Xrunoii.

-Xbootclasspath
  /a:<OptItdir>/lib/oibcp.jar

JDK 1.2 and newer only. Appends Optimizeit classes to the boot classes. Replace <OptItdir> with the directory where you installed Optimizeit.

-Xboundthreads

JDK 1.3.1 and 1.4/Hotspot on Solaris machines only. This option is used to bind user threads to lightweight process (LWP), required by Profiler.

-Djava.compiler=NONE

JDK 1.2 only. This option disables the JIT, which is required for JDK version 1.2.

-Xnoclassgc (JDK 1.2 only)

With early Java versions, the Optimizeit Profiler audit system must have class garbage collection disabled. Always use the -Xnoclassgc JVM argument when starting an application from the command line.

-native

JDK 1.2 on Solaris platforms only. If your virtual machine uses green threads you should suppress the -native option and add -DOPTITTHR=green and -DOPTITDIR=<OptDir> (where <OptDir> is the directory where you installed Optimizeit). The invocation becomes:

<P class=MsoNormal style="MARGIN: 0cm 0cm 0
21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号