JProfiler7.2.3安装和使用
??? ?}
??//hello = (Hello.Iface) appContext.getBean("gpHelloIface");
?}
?
?@Override
?public SampleResult runTest(JavaSamplerContext context) {
??SampleResult result = new SampleResult();
???? result.setSuccessful(false);
???? result.sampleStart();
???? try {
???? ?hello.helloString(testStr);//只有这个地方需要修改,写你的具体业务方法
???result.setSuccessful(true);
??} catch (Exception e) {
??} finally {
??????????? result.sampleEnd();
??}
??return result;
?}
}
?补充,在线程熟悉中,线程数:一般是模拟客户端的数量,Ramp-Up指定线程启动时间
?
3.然后说说JProfiler7.2.3的安装使用:
1)以普通的JavaApp为例子(Tomcat和JBoss等例子网上也很多):
如果是windows作为服务端,直接点击JProfiler.exe进入图形界面,引导安装即可,比较简单
如果是linux作为服务端,直接执行.sh的文件即可。可能需要授权:chomd +x jpro*.sh,虚拟机在加上
(我的licensekey是到官网临时申请的)
?2)windows的启动脚本示例:@echo off
title Prop-Main
java -classpath ..\conf;..\lib\* -agentpath:jprofilerti=port=8849,config=C:\Users\Administrator\.jprofiler7\config.xml -Xbootclasspath/a:C:\PROGRA~1\JPROFI~1\bin\WINDOW~1s\agent.jar com.jd.saf.thrift.ThriftServer
pause
3)linux的启动脚本示例:
nohup java -classpath ../conf/:../lib/* -server -Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxNewSize=512m -XX:MaxPermSize=512m -Djava.awt.headless=true? -agentlib:jprofilerti=port=8849 -Xbootclasspath/a:/opt/jprofiler/jprofiler7/bin/agent.jar? com.jd.saf.thrift.ThriftServer? com.jd.saf.thrift.ThriftServer
7.2.3的版本,写启动脚本需要特别注意,和之前的版本比不需要其他复杂麻烦的操作