jitwatch icon indicating copy to clipboard operation
jitwatch copied to clipboard

Idea plugin suggestion

Open skybber opened this issue 1 year ago • 13 comments

Hello,

I've been using JitWatch for some time and appreciate its capabilities in analyzing JIT compilation in Java. I'd like to propose modifying JitWatch into a plugin for IntelliJ IDEA. Integrating it directly into the IDE could offer advantages like better interaction with source code and other tools provided by Idea.

I've developed a prototype plugin that appears as a Tool Window in IntelliJ. A short demo video is available here: https://youtu.be/cGskItzVZyQ

I think it wouldn't be too difficult to get this plugin to a usable state, and I'm willing to invest time into the project to develop its potential further. I'd be happy to contribute to the development and collaborate on making this integration a reality :)

skybber avatar Oct 14 '24 18:10 skybber

Yes it is very promising, I can help and very interested !

Hi Chris !!

bourgesl avatar Oct 15 '24 08:10 bourgesl

Hi @skybber @bourgesl there was an IDEA plugin for JITWatch built by @yole back in 2016 : https://github.com/AdoptOpenJDK/jitwatch/pull/206

Maybe it's possible to extend that to achieve what you need?

Kind regards,

Chris

chriswhocodes avatar Oct 15 '24 11:10 chriswhocodes

For reference, the code of my plugin is here: https://github.com/yole/jitwatch-intellij

yole avatar Oct 15 '24 11:10 yole

I have read both plugins. Jitwatch is more advanced, jitwatch-idea provides better integration to IDEA. jitwatch is ~45k lines of code and it seems too much work to port it to Swing at once. It seems to me easier to make jitswatch working as IDEA plugin at first, than integrate with IDEA editor and then (optionally) switch it to Swing.

skybber avatar Oct 15 '24 11:10 skybber

Hi @skybber what's the bigger problem you're trying to solve?

JITWatch works as a standalone desktop application on all platforms with a JavaFX UI. It also exposes the engine so you can run it headless, as a plugin, or with a different UI. There shouldn't need to be any changes to the core.

Kind regards,

Chris

chriswhocodes avatar Oct 15 '24 12:10 chriswhocodes

Hi Chris, for me, the main issue was the seamless integration with the source code. I had trouble configuring JITWatch for a project with a large number of modules, so I made my own modifications that don't depend on the source code. I think that the infrastructure for integrating a decompiler and downloading source files from JAR files is currently missing in JITWatch? This could potentially be solved in IDEA. Another issue is the slowness of the time graphs displaying method compilations, which become useless when dealing with projects that have tens of thousands of compilations.

skybber avatar Oct 15 '24 13:10 skybber

Firstly, thanks for creating JITWatch—it's a great tool. I'm working on - jitwatch4i - plugin for IntelliJ, which is based on JITWatch and jitwatch-idea. The plugin uses the core of JITWatch (unchanged) but completely reworks the UI into Swing. The end result seems faster compared to JavaFX. For the parts derived from the original JITWatch UI, I’ve kept the headers with credits intact. Right now, the plugin is in beta, and the source code is available at:

https://github.com/skybber/jitwatch4i

I wanted to ask if you’d be open to changing jitwatch4i license from BSD to Apache v2.0, or at least discuss what conditions would make that feasible (I'm asking since the jitwatch is BSD). The main reason is fact, that Idea plugins are usually distributed with Apache v2.0.

skybber avatar Nov 19 '24 18:11 skybber

Hi @skybber , I chose the BSD 2-clause license because it's one of the the least restrictive open source licenses so anyone can extend and share JITWatch any way they like, including commercially. I don't think it benefits the community to try to change to a more restrictive license? With over 30 contributors to the project it would also be legally difficult.

I see you've chosen to copy the JITWatch source files into your project? Would it not be better to make a dependency on jitwatch-core so that you can benefit from any updates I make?

Kind regards,

Chris

chriswhocodes avatar Nov 20 '24 11:11 chriswhocodes

Regarding the BSD license, that makes sense, I hadn't realized that. So jitwatch4i will also be BSD - it's simpler.

The core is in the project because it's more flexible for changes on start of project. I plan to use a standard JitWatch core from maven in future. For example, I worked on support for visualizing L1-L4 in a timeline graph, and the core currently does not have it.

skybber avatar Nov 20 '24 13:11 skybber

Cool, I will look at publishing JITWatch-core as a maven artefact.

chriswhocodes avatar Nov 20 '24 16:11 chriswhocodes

Looks good to see smart people collaborate so fluently for all goods!

Congratulations!

bourgesl avatar Nov 20 '24 19:11 bourgesl

I would like to use jitwatch as external dep, but there are some "Vulnerabilities from dependencies:"

https://mvnrepository.com/artifact/com.chrisnewland/jitwatch/1.1.5

skybber avatar Dec 03 '24 18:12 skybber

Hi, please ignore that version, it's ancient. I will create a new artifact.

chriswhocodes avatar Dec 03 '24 19:12 chriswhocodes