Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMH IntelliJ integration #11863

Closed
lpetrovic05 opened this issue Mar 4, 2024 · 3 comments · Fixed by #11865
Closed

JMH IntelliJ integration #11863

lpetrovic05 opened this issue Mar 4, 2024 · 3 comments · Fixed by #11865
Assignees

Comments

@lpetrovic05
Copy link
Contributor

IntelliJ has a play button for JMH tests:
image

Unfortunately, when trying to run a JMH test this way, it will not run. This would be a useful feature to have.

@hendrikebbers
Copy link
Member

Or at least have a pattern for a command line call to execute only 1 JMH test

@jjohannes
Copy link
Contributor

The example in the description can be confusing. The button is there, because there is a main(...) method in ConsensusBenchmark so IntelliJ offers to run it as a Java application. If you look at other tests – for example LoggingBenchmark – there is no button.


Is there any good way to run a single test right now with a Gradle command? As far as I can see, the Gradle plugin does not offer something for that out of the box. I could add a parameter so that you can do:

./gradlew :swirlds-logging:jmh -PjmhTests=LoggingBenchmark$executeSimpleLogWithMessageWithPlaceholder

Would that make sense?

Then there is an IntelliJ plugin: https://plugins.jetbrains.com/plugin/7529-jmh-java-microbenchmark-harness
I tried this, with one modification to the setup it seems to work well:

bench

I can prepare a PR to:

  1. ...allow running a single test from command line using -PjmhTests
  2. ...using the IntelliJ plugin to run from IntelliJ

@jjohannes
Copy link
Contributor

jjohannes commented Mar 4, 2024

Please install the IntelliJ plugin and give this a try: #11865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants