< prev index next >
src/share/vm/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
Print this page
rev 9464 : PR for JDK8
*** 1,7 ****
/*
! * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 138,156 ****
_stack_trace_repo(stack_trace_repo), _writer(writer), _count(0) {
JfrStacktrace_lock->lock();
}
~StackTraceWrite() {
assert(JfrStacktrace_lock->owned_by_self(), "invariant");
JfrStacktrace_lock->unlock();
}
void sample_do(ObjectSample* sample) {
assert(sample != NULL, "invariant");
if (!sample->is_dead()) {
if (sample->has_stack_trace()) {
JfrTraceId::use(sample->klass(), true);
! _stack_trace_repo.write(_writer, sample->stack_trace_id(), sample->stack_trace_hash());
++_count;
}
}
}
--- 138,159 ----
_stack_trace_repo(stack_trace_repo), _writer(writer), _count(0) {
JfrStacktrace_lock->lock();
}
~StackTraceWrite() {
assert(JfrStacktrace_lock->owned_by_self(), "invariant");
+ // TODO: or after the unlock ?
JfrStacktrace_lock->unlock();
+ JfrStackTraceRepository::clear_leak_profiler();
}
void sample_do(ObjectSample* sample) {
assert(sample != NULL, "invariant");
if (!sample->is_dead()) {
if (sample->has_stack_trace()) {
JfrTraceId::use(sample->klass(), true);
! traceid t = JfrStackTraceRepository::write_for_leak_profiler(_writer, sample->stack_trace_id(), sample->stack_trace_hash());
! tty->print_cr("ObjectSampleCheckpoint.cpp| Write %ld stack trace id | traceid %ld", sample->stack_trace_id(), t);
++_count;
}
}
}
*** 276,285 ****
--- 279,289 ----
int count = 0;
{
StackTraceWrite stack_trace_write(_stack_trace_repo, writer); // JfrStacktrace_lock
do_samples(last, last_resolved, stack_trace_write);
count = stack_trace_write.count();
+ tty->print_cr("ObjectSampleCheckpoint.cpp| Write %d stack traces", count);
}
if (count == 0) {
writer.set_context(ctx);
return true;
}
< prev index next >