equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "gc_implementation/shared/copyFailedInfo.hpp" |
26 #include "gc_implementation/shared/copyFailedInfo.hpp" |
27 #include "gc_implementation/shared/gcHeapSummary.hpp" |
27 #include "gc_implementation/shared/gcHeapSummary.hpp" |
|
28 #include "gc_implementation/shared/gcId.hpp" |
28 #include "gc_implementation/shared/gcTimer.hpp" |
29 #include "gc_implementation/shared/gcTimer.hpp" |
29 #include "gc_implementation/shared/gcTrace.hpp" |
30 #include "gc_implementation/shared/gcTrace.hpp" |
30 #include "gc_implementation/shared/objectCountEventSender.hpp" |
31 #include "gc_implementation/shared/objectCountEventSender.hpp" |
31 #include "memory/heapInspection.hpp" |
32 #include "memory/heapInspection.hpp" |
32 #include "memory/referenceProcessorStats.hpp" |
33 #include "memory/referenceProcessorStats.hpp" |
36 |
37 |
37 #if INCLUDE_ALL_GCS |
38 #if INCLUDE_ALL_GCS |
38 #include "gc_implementation/g1/evacuationInfo.hpp" |
39 #include "gc_implementation/g1/evacuationInfo.hpp" |
39 #endif |
40 #endif |
40 |
41 |
41 #define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?") |
42 #define assert_unset_gc_id() assert(_shared_gc_info.gc_id().is_undefined(), "GC already started?") |
42 #define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?") |
43 #define assert_set_gc_id() assert(!_shared_gc_info.gc_id().is_undefined(), "GC not started?") |
43 |
|
44 static GCId GCTracer_next_gc_id = 0; |
|
45 static GCId create_new_gc_id() { |
|
46 return GCTracer_next_gc_id++; |
|
47 } |
|
48 |
44 |
49 void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) { |
45 void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) { |
50 assert_unset_gc_id(); |
46 assert_unset_gc_id(); |
51 |
47 |
52 GCId gc_id = create_new_gc_id(); |
48 GCId gc_id = GCId::create(); |
53 _shared_gc_info.set_id(gc_id); |
49 _shared_gc_info.set_gc_id(gc_id); |
54 _shared_gc_info.set_cause(cause); |
50 _shared_gc_info.set_cause(cause); |
55 _shared_gc_info.set_start_timestamp(timestamp); |
51 _shared_gc_info.set_start_timestamp(timestamp); |
56 } |
52 } |
57 |
53 |
58 void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) { |
54 void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) { |
60 |
56 |
61 report_gc_start_impl(cause, timestamp); |
57 report_gc_start_impl(cause, timestamp); |
62 } |
58 } |
63 |
59 |
64 bool GCTracer::has_reported_gc_start() const { |
60 bool GCTracer::has_reported_gc_start() const { |
65 return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID; |
61 return !_shared_gc_info.gc_id().is_undefined(); |
66 } |
62 } |
67 |
63 |
68 void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
64 void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
69 assert_set_gc_id(); |
65 assert_set_gc_id(); |
70 |
66 |
79 void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) { |
75 void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) { |
80 assert_set_gc_id(); |
76 assert_set_gc_id(); |
81 |
77 |
82 report_gc_end_impl(timestamp, time_partitions); |
78 report_gc_end_impl(timestamp, time_partitions); |
83 |
79 |
84 _shared_gc_info.set_id(SharedGCInfo::UNSET_GCID); |
80 _shared_gc_info.set_gc_id(GCId::undefined()); |
85 } |
81 } |
86 |
82 |
87 void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) const { |
83 void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) const { |
88 assert_set_gc_id(); |
84 assert_set_gc_id(); |
89 |
85 |
130 |
126 |
131 KlassInfoTable cit(false); |
127 KlassInfoTable cit(false); |
132 if (!cit.allocation_failed()) { |
128 if (!cit.allocation_failed()) { |
133 HeapInspection hi(false, false, false, NULL); |
129 HeapInspection hi(false, false, false, NULL); |
134 hi.populate_table(&cit, is_alive_cl); |
130 hi.populate_table(&cit, is_alive_cl); |
135 ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now()); |
131 ObjectCountEventSenderClosure event_sender(_shared_gc_info.gc_id(), cit.size_of_instances_in_words(), Ticks::now()); |
136 cit.iterate(&event_sender); |
132 cit.iterate(&event_sender); |
137 } |
133 } |
138 } |
134 } |
139 } |
135 } |
140 #endif // INCLUDE_SERVICES |
136 #endif // INCLUDE_SERVICES |