--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp Thu Jun 28 15:06:55 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp Thu Jun 28 15:13:39 2018 +0200
@@ -32,9 +32,10 @@
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
#include "jfr/support/jfrThreadLocal.hpp"
#include "jfr/utilities/jfrTryLock.hpp"
+#include "logging/log.hpp"
+#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/thread.hpp"
-#include "logging/log.hpp"
ObjectSampler::ObjectSampler(size_t size) :
_priority_queue(new SamplePriorityQueue(size)),
@@ -73,8 +74,6 @@
thread->jfr_thread_local()->set_cached_stack_trace_id(stack_trace_id, stack_trace_hash);
}
- const JfrTicks allocation_time = JfrTicks::now();
-
JfrTryLock tryLock(&_tryLock);
if (!tryLock.has_lock()) {
log_trace(jfr, oldobject, sampling)("Skipping old object sample due to lock contention");
@@ -114,7 +113,8 @@
sample->set_span(allocated);
sample->set_object((oop)obj);
sample->set_allocated(allocated);
- sample->set_allocation_time(allocation_time);
+ sample->set_allocation_time(JfrTicks::now());
+ sample->set_heap_used_at_last_gc(Universe::get_heap_used_at_last_gc());
_priority_queue->push(sample);
}