-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
[Truffle] Add tools for measuring startup time and memory consumption. #3296
Conversation
max_iterations = 100 | ||
|
||
lower = 0 | ||
upper = 4 * 1024 |
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.
Why 4 * 1024?
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.
It was just an initial size that was bound to be big enough. But now I think about it I can also search for the upper bound and not have one hard coded. I'll do that.
Looks good. |
@smarr please review if you have the time (especially https://github.com/jruby/jruby/pull/3296/files#diff-1c0dfa12324db9c68111f81e23be1ee6R1) |
|
||
private static void printTruffleMemoryMetric() { | ||
if (Options.TRUFFLE_METRICS_MEMORY_USED_ON_EXIT.load()) { | ||
System.gc(); |
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.
This seems to be problematic for multiple reasons.
Haven't yet read further in the changes, but, you are in the main method, and do a GC. So, I would expect, if there is no static state/memory leaks, after this GC, the used memory should be 0.
So, you might want to get the heap usage before the GC.
Also, System.gc() is really just a hint on HotSpot, you have to call it 3-4 times in succession to motivate HotSpot to actually do a collect (but, this then usually works).
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.
Ok, I now saw that you parse verbose:gc, nice. Ok, but you probably still want to call System.gc() multiple times to make sure it triggers. Then, I would assume that the verbose:gc output gives you a sum of all the objects that made it into GCed memory.
Looks good to me!
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.
JRuby has a great deal of static state (even though it is actually re-entrant) so I still need to check heap usage right at the end. Now I think about it I'm not sure what the point is of the GC at the end, given that I need to check heap usage after it anyway.
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.
side note: there may be a reliable way how to force gc in JVMTI, http://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#ForceGarbageCollection. I did not use it though.
[Truffle] Add tools for measuring startup time and memory consumption.
@pitr-ch @eregon @nirvdrum please review