Intellij IDEA集成JProfiler性能分析神器
環境
JProfiler 17.1.3(IDEA插件)
JProfiler 9.2(可執行軟件)
IntelliJ IDEA 2017.2.5
下載
下載JProfiler(IDEA)插件
方式1:?
在IDEA上直接下載Settings–plugins–Browse repositories?
搜索JProfiler 點擊 install 按鈕安裝,然后從啟IDEA工具?
?
看到如下圖片則說明安裝完成?
方式2:?
官網下載插件,手動安裝?
在首頁向下翻,中部位置能看到JProfiler最新版本,包括歷史版本下載鏈接,本教程中我們選擇17.1.3版本。點擊DOWNLOAD進行下載。?
JProfiler官方下載地址?
把從下載的壓縮包解壓出來的JProfiler文件夾,copy到IDEA自定義插件目錄,默認路徑:C:\Users\Administrator.IntelliJIdea2017.2\config\plugins?
從啟IDEA看到如下圖標則安裝成功:?
注:關于IDEA的使用可以看教程IntelliJ IDEA 使用初、中、高級詳細教程
安裝
安裝JProfiler監控軟件
官方下載地址?
右上角可以選擇要下載版本?
?
注: 本教程選擇的版本是9.2
下載完雙擊運行,選擇自定義目錄安裝,點擊Next?
選擇安裝路徑,建議選擇一個文件名中沒有中文,沒有空格的路徑因為如果改手動啟動時,空格識別不了。然后一直點Next?
配置
配置IDEA運行環境
Settings–Tools–JProflier–JProflier executable選擇JProfile安裝可執行文件。(如果系統只裝了一個版本,啟動IDEA時會默認選擇)保存?
選擇你要分析的項目,點擊JProfiler圖標啟動。?
啟動完成會自動彈出JProfiler窗口,在里面就可以監控自己的代碼性能了。?
至此IDEA中配置JProfiler做性能分析就完成了!
擴展
配置JRebel和JProfiler同時運行
有些人在IDEA中配置了JRebel熱部署,要想JRebel和JProfiler同時運行,就要改手動管理JProfiler session了。
方式1:?
通過點擊tomcat的啟動腳本啟動?
在要分析的tomcat啟動腳本catalina.bat中增加一行。
set CATALINA_OPTS=-agentpath:D:\service\jprofiler9\bin\windows-x64\jprofilerti.dll=port=8849,nowait,id=80,config=C:\Users\Administrator\.jprofiler9\config.xml %CATALINA_OPTS%
方式2:?
通過Idea JRebel 啟動?
在IDEA Run/Debug Configurations窗口JRebel Debug中配置Environment Variables屬性。
CATALINA_OPTS=-agentpath:D:\service\jprofiler9\bin\windows-x64\jprofilerti.dll\=port\=8849,nowait,id\=81,config\=C:\Users\Administrator\.jprofiler9\config.xml
?
啟動JRebel?
看到控制臺如下信息,說明JRebel和JProfiler都啟動了。
JProfiler> Protocol version 55
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> Don't wait for frontend to connect.
JProfiler> 64-bit library
JProfiler> Using config file C:\Users\Administrator\.jprofiler9\config.xml (id: 80)
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
2018-02-05 17:55:02 JRebel:
2018-02-05 17:55:02 JRebel: A newer version '7.1.5' is available for download
2018-02-05 17:55:02 JRebel: from http://zeroturnaround.com/software/jrebel/download/
2018-02-05 17:55:02 JRebel:
Connected to the target VM, address: '127.0.0.1:61805', transport: 'socket'
JProfiler> VM initialized
2018-02-05 17:55:02 JRebel: Contacting myJRebel server ..
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: ? ? ? ?Apache Tomcat/7.0.64
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: ? ? ? ? ?Aug 19 2015 17:18:06 UTC
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: ? ? ? ? 7.0.64.0
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: ? ? ? ? ? ? ? Windows 7
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: ? ? ? ? ? ?6.1
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: ? ? ? ? ?amd64
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: ? ? ? ? ? ? D:\service\Java\jdk1.8.0_101\jre
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: ? ? ? ? ? 1.8.0_101-b13
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: ? ? ? ? ? ?Oracle Corporation
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: ? ? ? ? C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_Service-ALL_7
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: ? ? ? ? D:\service\tomcat\Service-tomcat-7.0.64
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.base=C:\Users\Administrator\.jrebel
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.plugin.version=7.1.4
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.version=2017.2.5
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.product=IU
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide=intellij
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.notification.url=http://localhost:17434
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentpath:C:\Users\Administrator\.IntelliJIdea2017.2\config\plugins\jr-ide-idea\lib\jrebel6\lib\jrebel64.dll
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:61805,suspend=y,server=n
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-8
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote=
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.port=1099
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_Service-ALL_7\conf\logging.properties
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentpath:D:\service\jprofiler9\bin\windows-x64\jprofilerti.dll=port=8849,nowait,id=80,config=C:\Users\Administrator\.jprofiler9\config.xml
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\service\tomcat\Service-tomcat-7.0.64\endorsed
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_Service-ALL_7
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\service\tomcat\Service-tomcat-7.0.64
二月 05, 2018 5:55:04 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=D:\service\tomcat\Service-tomcat-7.0.64\temp
二月 05, 2018 5:55:04 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
二月 05, 2018 5:55:04 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2018-02-05 17:55:06 JRebel: ?Starting logging to file: C:\Users\Administrator\.jrebel\jrebel.log
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel: ?#############################################################
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel: ?JRebel Agent 7.1.4 (201712200830)
2018-02-05 17:55:06 JRebel: ?(c) Copyright ZeroTurnaround AS, Estonia, Tartu.
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel: ?Over the last 16 days JRebel prevented
2018-02-05 17:55:06 JRebel: ?at least 117 redeploys/restarts saving you about 0 hours.
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel: ?Licensed to wenyuan hou (using myJRebel).
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel:
2018-02-05 17:55:06 JRebel: ?#############################################################
2018-02-05 17:55:06 JRebel:
點擊jprofiler.exe?
執行菜單Session–Integr ation Wizards–New Server Integration?
?
選擇tomcat容器版本(7.X)?
?
選擇是本地測試還是遠程測試(本處選本地)?
?
選擇虛擬機的類型?
?
選擇Web容器是否和Jprofiler一起運行(我們使用JRebel啟動,所以選擇第二個)?
?
選擇tomcat啟動腳本?
?
選擇端口號默認就行?
然后一直Next,最后成功。?
完成!
?
總結
以上是生活随笔為你收集整理的Intellij IDEA集成JProfiler性能分析神器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 推荐系统算法总结(三)——FM与DNN
- 下一篇: jstat的小伙伴:找出system.g