10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/shared/gcHeapSummary.hpp"
27 #include "gc_implementation/shared/gcTimer.hpp"
28 #include "gc_implementation/shared/gcTrace.hpp"
29 #include "memory/referenceProcessorStats.hpp"
30 #include "runtime/atomic.hpp"
31 #include "utilities/globalDefinitions.hpp"
32
33 #define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?")
34 #define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?")
35
36 static volatile jlong GCTracer_next_gc_id = 0;
37 static GCId create_new_gc_id() {
38 return Atomic::add((jlong)1, &GCTracer_next_gc_id);
39 }
40
41 void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
42 assert_unset_gc_id();
43
44 GCId gc_id = create_new_gc_id();
45 _shared_gc_info.set_id(gc_id);
46 _shared_gc_info.set_cause(cause);
47 _shared_gc_info.set_start_timestamp(timestamp);
48 }
49
50 void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
51 assert_unset_gc_id();
52
53 report_gc_start_impl(cause, timestamp);
54 }
55
56 bool GCTracer::has_reported_gc_start() const {
57 return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
58 }
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc_implementation/shared/gcHeapSummary.hpp"
27 #include "gc_implementation/shared/gcTimer.hpp"
28 #include "gc_implementation/shared/gcTrace.hpp"
29 #include "memory/referenceProcessorStats.hpp"
30 #include "utilities/globalDefinitions.hpp"
31
32 #define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?")
33 #define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?")
34
35 static jlong GCTracer_next_gc_id = 0;
36 static GCId create_new_gc_id() {
37 return GCTracer_next_gc_id++;
38 }
39
40 void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
41 assert_unset_gc_id();
42
43 GCId gc_id = create_new_gc_id();
44 _shared_gc_info.set_id(gc_id);
45 _shared_gc_info.set_cause(cause);
46 _shared_gc_info.set_start_timestamp(timestamp);
47 }
48
49 void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
50 assert_unset_gc_id();
51
52 report_gc_start_impl(cause, timestamp);
53 }
54
55 bool GCTracer::has_reported_gc_start() const {
56 return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
57 }
|