< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
rev 48563 : [mq]: heap_to_thread
rev 48564 : [mq]: update-spec
rev 48565 : [mq]: event
@@ -231,10 +231,11 @@
set_handle_area(new (mtThread) HandleArea(NULL));
set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(30, true));
set_active_handles(NULL);
set_free_handle_block(NULL);
set_last_handle_mark(NULL);
+ _heap_sampler.set_thread(this);
// This initial value ==> never claimed.
_oops_do_parity = 0;
_threads_hazard_ptr = NULL;
_nested_threads_hazard_ptr = NULL;
@@ -259,11 +260,10 @@
omFreeList = NULL;
omFreeCount = 0;
omFreeProvision = 32;
omInUseList = NULL;
omInUseCount = 0;
- _bytes_until_sample = 0;
#ifdef ASSERT
_visited_for_critical_count = false;
#endif
@@ -5009,44 +5009,10 @@
List->unpark();
return;
}
}
-void Thread::pick_next_sample(size_t overflowed_bytes) {
- HeapMonitoring::pick_next_sample(&_bytes_until_sample);
-
- // Try to correct sample size by removing extra space from last allocation.
- if (overflowed_bytes > 0 && _bytes_until_sample > overflowed_bytes) {
- _bytes_until_sample -= overflowed_bytes;
- }
-}
-
-void Thread::check_for_sampling(HeapWord* ptr, size_t allocation_size, size_t bytes_since_allocation) {
- oopDesc* oop = reinterpret_cast<oopDesc*>(ptr);
- size_t total_allocated_bytes = bytes_since_allocation + allocation_size;
-
- // If not yet time for a sample, skip it.
- if (total_allocated_bytes < _bytes_until_sample) {
- _bytes_until_sample -= total_allocated_bytes;
- return;
- }
-
- HeapMonitoring::object_alloc_do_sample(this, oop, allocation_size);
-
- size_t overflow_bytes = total_allocated_bytes - _bytes_until_sample;
- pick_next_sample(overflow_bytes);
-}
-
-size_t Thread::bytes_until_sample() {
- if (!_bytes_until_sample) {
- pick_next_sample();
- }
-
- assert(_bytes_until_sample != 0, "Sampling size should never be 0");
- return _bytes_until_sample;
-}
-
void Threads::verify() {
ALL_JAVA_THREADS(p) {
p->verify();
}
VMThread* thread = VMThread::vm_thread();
< prev index next >