-
Notifications
You must be signed in to change notification settings - Fork 194
8439: ArithmeticException thrown when plotting event count histogram with maxDuration set to 0 #675
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
Conversation
…with maxDuration set to 0
👋 Welcome back aymane-harmaz! A progress list of the required criteria for merging this PR into |
@aymane-harmaz This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@thegreystone) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
// Get the maximum duration to set chart bounds | ||
IQuantity maxDuration = itemsWithDuration.getAggregate(JdkAggregators.LONGEST_EVENT); | ||
if (maxDuration == null) { | ||
if (maxDuration == null || maxDuration.doubleValueIn(UnitLookup.MILLISECOND) == 0.0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. To avoid FP equality and unit conversion surprises, please compare against zero using nanoseconds:
maxDuration.longValueIn(UnitLookup.NANOSECOND) == 0L
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the insight.
I used clampedLongValueIn
as the only critical case here is equality with 0L, and this way we don’t need to handle conversion exceptions explicitly
Good to go! |
Thanks for the review. /integrate |
@aymane-harmaz |
/sponsor |
Going to push as commit 58ca84a. |
@thegreystone @aymane-harmaz Pushed as commit 58ca84a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When plotting event count histogram and all event durations are set to 0, the duration range will be evaluated to 0, leading to an ArithmeticException (divid by 0), which stops JMC from plotting that histogram.
This can be shown on the attached screenshot, where only the percentile table is shown and the histogram chart is missing
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jmc.git pull/675/head:pull/675
$ git checkout pull/675
Update a local copy of the PR:
$ git checkout pull/675
$ git pull https://git.openjdk.org/jmc.git pull/675/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 675
View PR using the GUI difftool:
$ git pr show -t 675
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jmc/pull/675.diff
Using Webrev
Link to Webrev Comment