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 "gc_implementation/shared/gcWhen.hpp" 30 #include "gc_implementation/shared/promotionFailedInfo.hpp" 31 #include "trace/tracing.hpp" 32 #ifndef SERIALGC 33 #include "gc_implementation/g1/g1YCTypes.hpp" 34 #endif 35 36 // All GC dependencies against the trace framework is contained within this file. 37 38 typedef uintptr_t TraceAddress; 39 40 void GCTracer::send_garbage_collection_event() const { 41 EventGCGarbageCollection event(UNTIMED); 42 if (event.should_commit()) { 43 event.set_gcId(_shared_gc_info.id()); 44 event.set_name(_shared_gc_info.name()); 45 event.set_cause((u2) _shared_gc_info.cause()); 46 event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); 47 event.set_longestPause(_shared_gc_info.longest_pause()); 48 event.set_starttime(_shared_gc_info.start_timestamp()); 49 event.set_endtime(_shared_gc_info.end_timestamp()); 50 event.commit(); 51 } 86 EventGCOldGarbageCollection e(UNTIMED); 87 if (e.should_commit()) { 88 e.set_gcId(_shared_gc_info.id()); 89 e.set_starttime(_shared_gc_info.start_timestamp()); 90 e.set_endtime(_shared_gc_info.end_timestamp()); 91 e.commit(); 92 } 93 } 94 95 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { 96 EventPromotionFailed e; 97 if (e.should_commit()) { 98 e.set_gcId(_shared_gc_info.id()); 99 e.set_objectCount(pf_info.promotion_failed_count()); 100 e.set_firstSize(pf_info.first_size()); 101 e.set_smallestSize(pf_info.smallest_size()); 102 e.set_totalSize(pf_info.total_size()); 103 e.set_thread(pf_info.thread()->thread_id()); 104 e.commit(); 105 } 106 } 107 108 #ifndef SERIALGC 109 void G1NewTracer::send_g1_young_gc_event() { 110 EventGCG1GarbageCollection e(UNTIMED); 111 if (e.should_commit()) { 112 e.set_gcId(_shared_gc_info.id()); 113 e.set_type(_g1_young_gc_info.type()); 114 e.set_starttime(_shared_gc_info.start_timestamp()); 115 e.set_endtime(_shared_gc_info.end_timestamp()); 116 e.commit(); 117 } 118 } 119 #endif 120 121 static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) { 122 TraceStructVirtualSpace space; 123 space.set_start((TraceAddress)summary.start()); 124 space.set_committedEnd((TraceAddress)summary.committed_end()); 125 space.set_committedSize(summary.committed_size()); | 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 "gc_implementation/shared/gcWhen.hpp" 30 #include "gc_implementation/shared/promotionFailedInfo.hpp" 31 #include "memory/heapInspection.hpp" 32 #include "memory/iterator.hpp" 33 #include "trace/traceBackend.hpp" 34 #include "trace/tracing.hpp" 35 #include "utilities/globalDefinitions.hpp" 36 #ifndef SERIALGC 37 #include "gc_implementation/g1/g1YCTypes.hpp" 38 #endif 39 40 // All GC dependencies against the trace framework is contained within this file. 41 42 typedef uintptr_t TraceAddress; 43 44 void GCTracer::send_garbage_collection_event() const { 45 EventGCGarbageCollection event(UNTIMED); 46 if (event.should_commit()) { 47 event.set_gcId(_shared_gc_info.id()); 48 event.set_name(_shared_gc_info.name()); 49 event.set_cause((u2) _shared_gc_info.cause()); 50 event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); 51 event.set_longestPause(_shared_gc_info.longest_pause()); 52 event.set_starttime(_shared_gc_info.start_timestamp()); 53 event.set_endtime(_shared_gc_info.end_timestamp()); 54 event.commit(); 55 } 90 EventGCOldGarbageCollection e(UNTIMED); 91 if (e.should_commit()) { 92 e.set_gcId(_shared_gc_info.id()); 93 e.set_starttime(_shared_gc_info.start_timestamp()); 94 e.set_endtime(_shared_gc_info.end_timestamp()); 95 e.commit(); 96 } 97 } 98 99 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { 100 EventPromotionFailed e; 101 if (e.should_commit()) { 102 e.set_gcId(_shared_gc_info.id()); 103 e.set_objectCount(pf_info.promotion_failed_count()); 104 e.set_firstSize(pf_info.first_size()); 105 e.set_smallestSize(pf_info.smallest_size()); 106 e.set_totalSize(pf_info.total_size()); 107 e.set_thread(pf_info.thread()->thread_id()); 108 e.commit(); 109 } 110 } 111 112 void GCTracer::send_object_count_after_gc_event(klassOop klass, jlong count, julong total_size) const { 113 EventObjectCountAfterGC e; 114 if (e.should_commit()) { 115 e.set_gcId(_shared_gc_info.id()); 116 e.set_class(klass); 117 e.set_count(count); 118 e.set_totalSize(total_size); 119 e.commit(); 120 } 121 } 122 123 bool GCTracer::should_send_object_count_after_gc_event() const { 124 #if INCLUDE_TRACE 125 return Tracing::enabled(EventObjectCountAfterGC::eventId); 126 #else 127 return false; 128 #endif 129 } 130 131 #ifndef SERIALGC 132 void G1NewTracer::send_g1_young_gc_event() { 133 EventGCG1GarbageCollection e(UNTIMED); 134 if (e.should_commit()) { 135 e.set_gcId(_shared_gc_info.id()); 136 e.set_type(_g1_young_gc_info.type()); 137 e.set_starttime(_shared_gc_info.start_timestamp()); 138 e.set_endtime(_shared_gc_info.end_timestamp()); 139 e.commit(); 140 } 141 } 142 #endif 143 144 static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) { 145 TraceStructVirtualSpace space; 146 space.set_start((TraceAddress)summary.start()); 147 space.set_committedEnd((TraceAddress)summary.committed_end()); 148 space.set_committedSize(summary.committed_size()); |