SPECjvm2008是一个观测JRE运行性能的基准测试套件。它的测试用例涵盖了大部分java基础应用场景,是架构选型和JVM性能评测不可多得的利器。
SPECjvm2008 官方网站 : http://www.spec.org/
1、安装jdk
1.1 切换到root账号(能够有修改/etc/profile的权限的用户)
1.2 下载和安装jdk
把jdk安装在/home/user/runtime/中,把jdk-6u27-linux-x64.bin拷贝到/home/user/runtime/当中。
[root@localhost Desktop]# ./jdk-6u27-linux-x64.bin 回车,然后是同意协议,直接空格过去,然后点击enter,安装完毕。
1.3 修改/etc/profile [root@localhost Desktop]# vi /etc/profile 增加以下几行 export使变量生效
export JAVA_HOME=/home/fangming/runtime/jdk1.6.0_27
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
1.4 修改保存后,重新加载一次
[root@localhost Desktop]#source /etc/profile(当然可以reboot)
1.5 验证一下,环境变量是否设置正确
[root@localhost Desktop]# java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
1.6 至此jdk已经安装成功
2、SPECjvm2008安装
2.1 下载SPECjvm2008
下载完成后,是一个“SPECjvm2008_1_01_setup.jar”的安装包,可以前往SPECjvm2008官网进行下载。
2.2 安装SPECjvm2008
linux环境下添加参数-i console,使用命令行的方式进行安装,然后一步一步按照提示安装即可。命令如下:
$ java -jar SPECjvm2008_1_01_setup.jar -i console
2.3 验证SPECjvm2008是否安装成功
在安装目录下找到脚本run-specjvm.sh,./run-specjvm.sh startup.helloworld -ikv
startup.helloworld 用于测试helloworld程序的启动时间,选择这个测试用例是考虑到运行速度比较快。 -ikv的意思是跳过签名检查,这个过程比较慢,这里仅仅是测试SPECjvm。
[user@localhost SPECjvm2008]$ ./run-specjvm.sh startup.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: Tue Apr 01 19:10:43 PDT 2014
Iteration 1 (1 operation) ends: Tue Apr 01 19:10:44 PDT 2014
Iteration 1 (1 operation) result: PASSED
Valid run!
--- --- --- --- --- --- --- --- ---
Benchmark: startup.helloworld
Run mode: static run
Test type: sin