RFR: JDK-8060017: Report heap sizing time

Kim Barrett kim.barrett at oracle.com
Wed Mar 18 22:51:11 UTC 2015


On Mar 18, 2015, at 6:00 PM, Eric Caspole <eric.caspole at oracle.com> wrote:
> 
> Thanks Kim,
> I fixed the copyrights and a jchecky thing with trailing spaces I did not notice earlier. New one:
> http://cr.openjdk.java.net/~ecaspole/JDK-8060017/03/webrev/

------------------------------------------------------------------------------ 
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
3979           size_t expand_bytes = g1_policy()->expansion_amount();
3980           double expand_time_ms = 0.0;
3981           if (expand_bytes > 0) {
3982             double expand_heap_start_time_sec = os::elapsedTime();
3983             size_t bytes_before = capacity();
3984             // No need for an ergo verbose message here,
3985             // expansion_amount() does this when it returns a value > 0.
3986             if (!expand(expand_bytes)) {
3987               // We failed to expand the heap. Cannot do anything about it.
3988             }
3989             double expand_heap_end_time_sec = os::elapsedTime();
3990             expand_time_ms = (expand_heap_end_time_sec - expand_heap_start_time_sec) * MILLIUNITS;
3991           }
3992           g1_policy()->phase_times()->record_expand_heap_time(expand_time_ms);

[I meant to say something about this in the first round, but forgot.
Sorry about that.]

Seems like a lot more complicated than it really needs to be, in order
to avoid measuring and reporting the time for expand_bytes == 0.
------------------------------------------------------------------------------




More information about the hotspot-gc-dev mailing list