< prev index next >
src/hotspot/share/runtime/heapMonitoring.cpp
Print this page
rev 47590 : [mq]: heap8
rev 47591 : [mq]: heap10a
rev 47592 : [mq]: heap14_rebased
*** 207,217 ****
static StackTraceStorage internal_storage;
return &internal_storage;
}
void initialize(int max_storage) {
! MutexLocker mu(HeapMonitor_lock);
free_storage();
allocate_storage(max_storage);
memset(&_stats, 0, sizeof(_stats));
}
--- 207,217 ----
static StackTraceStorage internal_storage;
return &internal_storage;
}
void initialize(int max_storage) {
! MutexLocker mu(HeapMonitorStorage_lock);
free_storage();
allocate_storage(max_storage);
memset(&_stats, 0, sizeof(_stats));
}
*** 293,303 ****
StackTraceStorage* StackTraceStorage::internal_storage;
// Statics for Sampler
double HeapMonitoring::_log_table[1 << FastLogNumBits];
bool HeapMonitoring::_enabled;
- AlwaysTrueClosure HeapMonitoring::_always_true;
jint HeapMonitoring::_monitoring_rate;
// Cheap random number generator
uint64_t HeapMonitoring::_rnd;
--- 293,302 ----
*** 380,399 ****
_max_gc_storage = max_gc_storage;
_initialized = true;
}
void StackTraceStorage::add_trace(jvmtiStackTrace *trace, oop o) {
! MutexLocker mu(HeapMonitor_lock);
StackTraceData new_data(trace, o);
_stats.sample_count++;
_stats.stack_depth_accumulation += trace->frame_count;
_allocated_traces->append(new_data);
}
void StackTraceStorage::weak_oops_do(BoolObjectClosure *is_alive,
OopClosure *f) {
! MutexLocker mu(HeapMonitor_lock);
size_t count = 0;
if (initialized()) {
int len = _allocated_traces->length();
// Compact the oop traces. Moves the live oops to the beginning of the
--- 379,398 ----
_max_gc_storage = max_gc_storage;
_initialized = true;
}
void StackTraceStorage::add_trace(jvmtiStackTrace *trace, oop o) {
! MutexLocker mu(HeapMonitorStorage_lock);
StackTraceData new_data(trace, o);
_stats.sample_count++;
_stats.stack_depth_accumulation += trace->frame_count;
_allocated_traces->append(new_data);
}
void StackTraceStorage::weak_oops_do(BoolObjectClosure *is_alive,
OopClosure *f) {
! MutexLocker mu(HeapMonitorStorage_lock);
size_t count = 0;
if (initialized()) {
int len = _allocated_traces->length();
// Compact the oop traces. Moves the live oops to the beginning of the
*** 474,484 ****
}
void StackTraceStorage::copy_stack_traces(const StackTraceDataCopier &copier,
jvmtiStackTraces *traces) {
! MutexLocker mu(HeapMonitor_lock);
int len = copier.size();
// Create a new array to store the StackTraceData objects.
// + 1 for a NULL at the end.
jvmtiStackTrace *t =
--- 473,483 ----
}
void StackTraceStorage::copy_stack_traces(const StackTraceDataCopier &copier,
jvmtiStackTraces *traces) {
! MutexLocker mu(HeapMonitorStorage_lock);
int len = copier.size();
// Create a new array to store the StackTraceData objects.
// + 1 for a NULL at the end.
jvmtiStackTrace *t =
*** 564,573 ****
--- 563,573 ----
StackTraceStorage::storage()->weak_oops_do(is_alive, f);
}
void HeapMonitoring::initialize_profiling(jint monitoring_rate,
jint max_gc_storage) {
+ MutexLocker mu(HeapMonitor_lock);
// Ignore if already enabled.
if (_enabled) {
return;
}
*** 590,599 ****
--- 590,600 ----
StackTraceStorage::storage()->initialize(max_gc_storage);
_enabled = true;
}
void HeapMonitoring::stop_profiling() {
+ MutexLocker mu(HeapMonitor_lock);
_enabled = false;
}
// Generates a geometric variable with the specified mean (512K by default).
// This is done by generating a random number between 0 and 1 and applying
*** 611,624 ****
// Take the top 26 bits as the random number
// (This plus a 1<<58 sampling bound gives a max possible step of
// 5194297183973780480 bytes. In this case,
// for sample_parameter = 1<<19, max possible step is
// 9448372 bytes (24 bits).
! const uint64_t prng_mod_power = 48; // Number of bits in prng
// The uint32_t cast is to prevent a (hard-to-reproduce) NAN
// under piii debug for some binaries.
! double q = static_cast<uint32_t>(_rnd >> (prng_mod_power - 26)) + 1.0;
// Put the computed p-value through the CDF of a geometric.
// For faster performance (save ~1/20th exec time), replace
// min(0.0, FastLog2(q) - 26) by (Fastlog2(q) - 26.000705)
// The value 26.000705 is used rather than 26 to compensate
// for inaccuracies in FastLog2 which otherwise result in a
--- 612,625 ----
// Take the top 26 bits as the random number
// (This plus a 1<<58 sampling bound gives a max possible step of
// 5194297183973780480 bytes. In this case,
// for sample_parameter = 1<<19, max possible step is
// 9448372 bytes (24 bits).
! const uint64_t PrngModPower = 48; // Number of bits in prng
// The uint32_t cast is to prevent a (hard-to-reproduce) NAN
// under piii debug for some binaries.
! double q = static_cast<uint32_t>(_rnd >> (PrngModPower - 26)) + 1.0;
// Put the computed p-value through the CDF of a geometric.
// For faster performance (save ~1/20th exec time), replace
// min(0.0, FastLog2(q) - 26) by (Fastlog2(q) - 26.000705)
// The value 26.000705 is used rather than 26 to compensate
// for inaccuracies in FastLog2 which otherwise result in a
< prev index next >