Intellij IDEA集成JProfiler性能分析工具
環(huán)境
- JProfiler 17.1.3(IDEA插件)
- JProfiler 9.2(可執(zhí)行軟件)
- IntelliJ IDEA 2017.2.5
下載
下載JProfiler(IDEA)插件
方式1:在IDEA上直接下載Settings–plugins–Browse repositories
搜索JProfiler 點(diǎn)擊 install 按鈕安裝,然后從啟IDEA工具
看到如下圖片則說明安裝完成
方式2:官網(wǎng)下載插件,手動(dòng)安裝
在首頁(yè)向下翻,中部位置能看到JProfiler最新版本,包括歷史版本下載鏈接,本教程中我們選擇17.1.3版本。點(diǎn)擊DOWNLOAD進(jìn)行下載。
JProfiler官方下載地址
把從下載的壓縮包解壓出來的JProfiler文件夾,copy到IDEA自定義插件目錄,默認(rèn)路徑:C:\Users\Administrator.IntelliJIdea2017.2\config\plugins
從啟IDEA看到如下圖標(biāo)則安裝成功:
注:關(guān)于IDEA的使用可以看教程IntelliJ IDEA 使用初、中、高級(jí)詳細(xì)教程
安裝
安裝JProfiler監(jiān)控軟件
官方下載地址右上角可以選擇要下載版本
注: 本教程選擇的版本是9.2
下載完雙擊運(yùn)行,選擇自定義目錄安裝,點(diǎn)擊Next
選擇安裝路徑,建議選擇一個(gè)文件名中沒有中文,沒有空格的路徑因?yàn)槿绻氖謩?dòng)啟動(dòng)時(shí),空格識(shí)別不了。然后一直點(diǎn)Next
配置
配置IDEA運(yùn)行環(huán)境
Settings–Tools–JProflier–JProflier executable選擇JProfile安裝可執(zhí)行文件。(如果系統(tǒng)只裝了一個(gè)版本,啟動(dòng)IDEA時(shí)會(huì)默認(rèn)選擇)保存
選擇你要分析的項(xiàng)目,點(diǎn)擊JProfiler圖標(biāo)啟動(dòng)。
啟動(dòng)完成會(huì)自動(dòng)彈出JProfiler窗口,在里面就可以監(jiān)控自己的代碼性能了。
至此IDEA中配置JProfiler做性能分析就完成了!
擴(kuò)展
配置JRebel和JProfiler同時(shí)運(yùn)行
有些人在IDEA中配置了JRebel熱部署,要想JRebel和JProfiler同時(shí)運(yùn)行,就要改手動(dòng)管理JProfiler session了。
方式1:通過點(diǎn)擊tomcat的啟動(dòng)腳本啟動(dòng)
在要分析的tomcat啟動(dòng)腳本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 啟動(dòng)
在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
啟動(dòng)JRebel
看到控制臺(tái)如下信息,說明JRebel和JProfiler都啟動(dòng)了。
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:
點(diǎn)擊jprofiler.exe
執(zhí)行菜單Session–Integr ation Wizards–New Server Integration
選擇tomcat容器版本(7.X)
選擇是本地測(cè)試還是遠(yuǎn)程測(cè)試(本處選本地)
選擇虛擬機(jī)的類型
選擇Web容器是否和Jprofiler一起運(yùn)行(我們使用JRebel啟動(dòng),所以選擇第二個(gè))
選擇tomcat啟動(dòng)腳本
選擇端口號(hào)默認(rèn)就行
然后一直Next,最后成功。
到此這篇關(guān)于Intellij IDEA集成JProfiler性能分析工具的文章就介紹到這了,更多相關(guān)IDEA集成JProfiler內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
數(shù)組實(shí)現(xiàn)Java 自定義Queue隊(duì)列及應(yīng)用操作
這篇文章主要介紹了數(shù)組實(shí)現(xiàn)Java 自定義Queue隊(duì)列及應(yīng)用操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-06-06springboot項(xiàng)目防止XSS攻擊和sql注入方式
這篇文章主要介紹了springboot項(xiàng)目防止XSS攻擊和sql注入方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07Spring Boot實(shí)現(xiàn)分布式鎖的自動(dòng)釋放的示例代碼
在實(shí)際開發(fā)中,我們可以使用 Redis、Zookeeper 等分布式系統(tǒng)來實(shí)現(xiàn)分布式鎖,本文將介紹如何使用 Spring Boot 來實(shí)現(xiàn)分布式鎖的自動(dòng)釋放,感興趣的朋友跟隨小編一起看看吧2023-06-06