1.下载jar包后需要安装SPECjvm,命令如下,注意需要添加参数-i console。
$ java -jar SPECjvm2008_1_01_setup.jar -i console
2.设置$JAVA_HOME等环境变量
我在HOST上使用的是Fedora19自带的OpenJDK,
在文件/etc/profile中设置如下:
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.2.7.fc19.x86_64
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:/lib.dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
保存后,执行 source /etc/profile即可。
3.测试SPECjvm是否安装成功
在安装目录下找到脚本run-specjvm.sh
./run-specjvm.sh startup.helloworld -ikv
startup.helloworld 用于测试helloworld程序的启动时间,选择这个测试用例是考虑到运行速度比较快。 -ikv的意思是跳过签名检查,这个过程有点慢。
成功后显示如下所是:
SPECjvm2008 Base
Properties file: none
Benchmarks: startup.helloworld
WARNING: Run will not be compliant.
Not a compliant sequence of benchmarks for publication.
Property specjvm.run.checksum.validation must be true for publication.
--- --- --- --- --- --- --- --- ---
Benchmark: check
Run mode: static run
Test type: functional
Threads: 1
Iterations: 1
Run length: 1 operation
Iteration 1 (1 operation) begins: Wed Oct 30 10:22:23 CST 2013
Iteration 1 (1 operation) ends: Wed Oct 30 10:22:23 CST 2013
Iteration 1 (1 operation) result: PASSED
Valid run!
--- --- --- --- --- --- --- --- ---
Benchmark: startup.helloworld
Run mode: static run
Test type: single
Threads: 1
Iterations: 1
Run length: 1 operation
Iteration 1 (1 operation) begins: Wed Oct 30 10:22:23 CST 2013
Iteration 1 (1 operation) ends: Wed Oct 30 10:22:23 CST 2013
Iteration 1 (1 operation) result: 413.79 ops/m
Valid run!
Score on startup.helloworld: 413.79 ops/m
Results are stored in:
/root/SPEC/results/SPECjvm2008.001/SPECjvm2008.001.raw
Generating reports in:
/root/SPEC/results/SPECjvm2008.001
Noncompliant composite result: 413.79 ops/m