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

StatisticsHelper: Fix lack of "garbage generated" data (zeros) #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dsmiley
Copy link

@dsmiley dsmiley commented Sep 20, 2018

StatisticsHelper: Remove attempts to "setDaemon" the stats polling thread
And update memory status one final time in stopStatistics().

Closes #24

…read

And update memory status one final time in stopStatistics()

Closes mikemccand#24
@mikemccand
Copy link
Owner

I'm a little confused on what the bug was here.

E.g. were you seeing all 0 for the GC statistics at the end of all benchmark runs? Because we were missing the final run call during stopStatistics?

@@ -30,6 +31,8 @@

private final AtomicInteger starts = new AtomicInteger();

// TODO reconsider "volatile" everywhere here; we don't need synchronization based on how we use this

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we could also make these final?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple booleans but not the pools because they are set in the loop.

// is the only thread left:
Thread.currentThread().setDaemon(true);

if (!hasMemoryPools)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should simply throw an exception on construction if there are no memory pools? Don't all modern JVMs support this API?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real concern is the naming assumptions of the pools that can lead to hasMemoryPools becoming false even though the API is present. See my latest commit which fixes it for JDK 11 by being more loose in the detecting the pool name (exact string vs simple contains). Still, the essence of your point stands -- what to do? I think it's a bit much to throw an exception; I'd prefer perhaps a louder warning plus an assert statement even though we don't have tests.

@dsmiley
Copy link
Author

dsmiley commented Apr 21, 2020

I'm a little confused on what the bug was here.

E.g. were you seeing all 0 for the GC statistics at the end of all benchmark runs? Because we were missing the final run call during stopStatistics?

They will show as "N/A" because hasMemoryPools is false because some of the pool names were not correctly identified. I think there was a separate issue to which I have comments in the issue pertaining to setDaemon etc. and other aspects here. It's been many months for this part and I'm less sure of that.

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 this pull request may close these issues.

StatisticsHelper doesn't generate "Garbage Generated" output
2 participants