From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8870 invoked by alias); 2 Aug 2012 13:11:08 -0000 Received: (qmail 7804 invoked by uid 22791); 2 Aug 2012 13:11:05 -0000 X-SWARE-Spam-Status: No, hits=-8.7 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,MAY_BE_FORGED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Aug 2012 13:10:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q72DAkqs022809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Aug 2012 09:10:46 -0400 Received: from redhat.com (unused [10.15.16.143] (may be forged)) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q72DAetu022011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 2 Aug 2012 09:10:43 -0400 Date: Thu, 02 Aug 2012 13:11:00 -0000 From: Lukas Berk To: distro-pkg-dev@openjdk.java.net Cc: systemtap@sourceware.org Subject: [RFC] Enhanced Garbage Collection Probe Points Message-ID: <20120802131039.GA1955@redhat.com> Reply-To: Lukas Berk MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kORqDWCi7qDJ0mEj" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2012-q3/txt/msg00130.txt.bz2 --kORqDWCi7qDJ0mEj Content-Type: multipart/mixed; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 732 Hey, I've been working on adding improved probe point within the garbage collection system. This will allow system administrators using various tools to better analyze which garbage collection algorithms are effective and java developers to better understand how (often) their objects are being collected. Specific probe points that I've aimed to include are: - G1, concurrent mark sweep, parallel mark sweep, and tenured collections - new generation definitions - parallel scavenges - parallel compaction - object 'moves/resizes' between memory addresses Please note that the attached patch should be appended to the patch/systemtap.patch file. Any feedback or suggestions would be greatly appreciated. Cheers, Lukas --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="systemtap.patch" Content-Transfer-Encoding: quoted-printable Content-length: 13427 diff -Nru openjdk.orig/hotspot/src/share/vm/memory/generation.cpp openjdk/h= otspot/src/share/vm/memory/generation.cpp --- openjdk.orig/hotspot/src/share/vm/memory/generation.cpp 2012-06-15 11:3= 6:43.022837742 -0400 +++ openjdk/hotspot/src/share/vm/memory/generation.cpp 2012-06-15 13:35:39.= 714838057 -0400 @@ -40,6 +40,11 @@ #include "runtime/java.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" +#include "utilities/dtrace.hpp" + +#ifndef USDT2 + HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig, bool, bool, size= _t, bool); +#endif /* !USDT2 */ =20 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : _level(level), @@ -471,6 +476,9 @@ ReferenceProcessorSpanMutator x(ref_processor(), GenCollectedHeap::heap()->reserved_region()); GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_sof= t_refs); +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__contig, full, clear_all_soft_r= efs, size, is_tlab); +#endif /* !USDT2 */ SpecializationStats::print(); } =20 diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMar= kSweep/concurrentMarkSweepGeneration.cpp openjdk/hotspot/src/share/vm/gc_im= plementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep= /concurrentMarkSweepGeneration.cpp 2012-06-15 11:36:42.164837741 -0400 +++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/conc= urrentMarkSweepGeneration.cpp 2012-06-15 13:35:45.224838227 -0400 @@ -55,6 +55,11 @@ #include "runtime/vmThread.hpp" #include "services/memoryService.hpp" #include "services/runtimeService.hpp" +#include "utilities/dtrace.hpp" + +#ifndef USDT2 + HS_DTRACE_PROBE_DECL4(provider, gc__collection__contig, bool, bool, size= _t, bool); +#endif /* !USDT2 */ =20 // statics CMSCollector* ConcurrentMarkSweepGeneration::_collector =3D NULL; @@ -1655,6 +1660,10 @@ size_t size, bool tlab) { + +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__contig, full, clear_all_soft_r= efs, size, tlab); +#endif /* !USDT2 */ if (!UseCMSCollectionPassing && _collectorState > Idling) { // For debugging purposes skip the collection if the state // is not currently idle diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNew= Generation.cpp openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNew= Generation.cpp --- openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGenera= tion.cpp 2012-06-15 11:36:41.816837741 -0400 +++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.= cpp 2012-06-15 13:35:56.298821181 -0400 @@ -49,6 +49,11 @@ #include "utilities/copy.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/workgroup.hpp" +#include "utilities/dtrace.hpp" + +#ifndef USDT2 + HS_DTRACE_PROBE_DECL4(provider, gc__collection__parnew, bool, bool, size= _t, bool); +#endif /* !USDT2 */ =20 #ifdef _MSC_VER #pragma warning( push ) @@ -878,6 +883,9 @@ bool clear_all_soft_refs, size_t size, bool is_tlab) { +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__parnew, full, clear_all_soft_r= efs, size, is_tlab); +#endif /* !USDT2 */ assert(full || size > 0, "otherwise we don't want to collect"); GenCollectedHeap* gch =3D GenCollectedHeap::heap(); assert(gch->kind() =3D=3D CollectedHeap::GenCollectedHeap, diff -Nru openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp ope= njdk/hotspot/src/share/vm/memory/defNewGeneration.cpp --- openjdk.orig/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-06-1= 5 11:36:42.970837742 -0400 +++ openjdk/hotspot/src/share/vm/memory/defNewGeneration.cpp 2012-06-15 13:= 36:05.328838805 -0400 @@ -39,6 +39,11 @@ #include "runtime/java.hpp" #include "utilities/copy.hpp" #include "utilities/stack.inline.hpp" +#include "utilities/dtrace.hpp" + +#ifndef USDT2 + HS_DTRACE_PROBE_DECL4(provider, gc__collection__defnew, bool, bool, size= _t, bool); +#endif /* !USDT2 */ #ifdef TARGET_OS_FAMILY_linux # include "thread_linux.inline.hpp" #endif @@ -528,6 +533,9 @@ bool clear_all_soft_refs, size_t size, bool is_tlab) { +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__defnew, full, clear_all_soft_r= efs, size, is_tlab); +#endif /* !USDT2 */ assert(full || size > 0, "otherwise we don't want to collect"); GenCollectedHeap* gch =3D GenCollectedHeap::heap(); _next_gen =3D gch->next_gen(this); diff -Nru openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp op= enjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp --- openjdk.orig/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-06-= 15 11:36:43.016837742 -0400 +++ openjdk/hotspot/src/share/vm/memory/tenuredGeneration.cpp 2012-06-15 13= :36:08.848839364 -0400 @@ -33,6 +33,11 @@ #include "memory/tenuredGeneration.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +#include "utilities/dtrace.hpp" + +#ifndef USDT2 + HS_DTRACE_PROBE_DECL4(provider, gc__collection__tenured, bool, bool, siz= e_t, bool); +#endif /* !USDT2 */ =20 TenuredGeneration::TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level, @@ -307,6 +312,9 @@ size_t size, bool is_tlab) { retire_alloc_buffers_before_full_gc(); +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__tenured, full, clear_all_soft_= refs, size, is_tlab); +#endif /* !USDT2 */ OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs, size, is_tlab); } diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScave= nge/parallelScavengeHeap.cpp openjdk/hotspot/src/share/vm/gc_implementation= /parallelScavenge/parallelScavengeHeap.cpp --- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/pa= rallelScavengeHeap.cpp +++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/paralle= lScavengeHeap.cpp @@ -40,8 +40,13 @@ #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/vmThread.hpp" +#include "utilities/dtrace.hpp" #include "utilities/vmError.hpp" =20 +#ifndef USDT2 + HS_DTRACE_PROBE_DECL2(provider, gc__collection__parscavenge, *uintptr_t,= *uintptr_t); +#endif /* !USDT2 */ + PSYoungGen* ParallelScavengeHeap::_young_gen =3D NULL; PSOldGen* ParallelScavengeHeap::_old_gen =3D NULL; PSPermGen* ParallelScavengeHeap::_perm_gen =3D NULL; @@ -806,6 +811,9 @@ } =20 VM_ParallelGCSystemGC op(gc_count, full_gc_count, cause); +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__parscavenge, &op, cause); +#endif /* !USDT2 */ VMThread::execute(&op); } diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSwee= p.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp --- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp = 2012-06-26 09:24:22.472325287 -0400 +++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2012-= 07-05 10:43:08.273800575 -0400 @@ -45,8 +45,13 @@ #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" #include "utilities/copy.hpp" +#include "utilities/dtrace.hpp" #include "utilities/events.hpp" =20 +#ifndef USDT2 + HS_DTRACE_PROBE_DECL2(provider, gc__collection__G1, *uintptr_t, *uintptr= _t); +#endif /* !USDT2 */ + class HeapRegion; =20 void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, @@ -83,7 +88,9 @@ // We should save the marks of the currently locked biased monitors. // The marking doesn't preserve the marks of biased objects. BiasedLocking::preserve_marks(); - +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__G1, &sh, sh->gc_cause()); +#endif /* !USDT2 */ mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); =20 mark_sweep_phase2(); diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp openjdk/hot= spot/src/share/vm/compiler/oopMap.cpp --- openjdk.orig/hotspot/src/share/vm/compiler/oopMap.cpp 2012-06-26 09:24:= 22.390325184 -0400 +++ openjdk/hotspot/src/share/vm/compiler/oopMap.cpp 2012-07-06 10:12:44.98= 1413003 -0400 @@ -33,9 +33,13 @@ #include "memory/resourceArea.hpp" #include "runtime/frame.inline.hpp" #include "runtime/signature.hpp" +#include "utilities/dtrace.hpp" #ifdef COMPILER1 #include "c1/c1_Defs.hpp" #endif +#ifndef USDT2 + HS_DTRACE_PROBE_DECL1(provider, gc__collection__delete, *uintptr_t); +#endif /* !USDT2 */ =20 // OopMapStream =20 @@ -677,6 +681,9 @@ " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT = " (Offset: %d)", derived_loc, (address)*derived_loc, (address)base, offset); } +#ifndef USDT2 + HS_DTRACE_PROBE1(hotspot, gc__collection__delete, entry); +#endif /* !USDT2 */ =20 // Delete entry delete entry; --- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/ps= ParallelCompact.cpp 2012-07-12 09:48:40.349999515 -0400 +++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParal= lelCompact.cpp 2012-07-19 18:38:07.560757426 -0400 @@ -53,11 +53,18 @@ #include "runtime/vmThread.hpp" #include "services/management.hpp" #include "services/memoryService.hpp" +#include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" =20 #include =20 +#ifndef USDT2 + HS_DTRACE_PROBE_DECL2(provider, gc__collection__ParallelCompact__clear, = *uintptr_t, *uintptr_t); + HS_DTRACE_PROBE_DECL2(provider, gc__collection__partest1, *uintptr_t, *u= intptr_t); + HS_DTRACE_PROBE_DECL4(provider, gc__collection__move, *uintptr_t, *uintp= tr_t, *uintptr_t, *uintptr_t); +#endif /* !USDT2 */ + // All sizes are in HeapWords. const size_t ParallelCompactData::Log2RegionSize =3D 9; // 512 words const size_t ParallelCompactData::RegionSize =3D (size_t)1 << Log2Reg= ionSize; @@ -433,6 +439,9 @@ =20 void ParallelCompactData::clear() { +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__ParallelCompact__clear, &_regi= on_data, _region_data->data_location()); +#endif /* !USDT2 */ memset(_region_data, 0, _region_vspace->committed_size()); } =20 @@ -1970,6 +1979,9 @@ "should be in vm thread"); =20 ParallelScavengeHeap* heap =3D gc_heap(); +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__partest1, heap, heap->gc_cause= ()); +#endif /* !USDT2 */ GCCause::Cause gc_cause =3D heap->gc_cause(); assert(!heap->is_gc_active(), "not reentrant"); =20 @@ -3376,6 +3388,9 @@ // past the end of the partial object entering the region (if any). HeapWord* const dest_addr =3D sd.partial_obj_end(dp_region); HeapWord* const new_top =3D _space_info[space_id].new_top(); +#ifndef USDT2 + HS_DTRACE_PROBE4(hotspot, gc__collection__move, &beg_addr, &end_addr, &d= est_addr, &new_top); +#endif /* !USDT2 */ assert(new_top >=3D dest_addr, "bad new_top value"); const size_t words =3D pointer_delta(new_top, dest_addr); =20 --- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/ps= Scavenge.cpp 2012-07-12 09:48:40.401000822 -0400 +++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScave= nge.cpp 2012-07-19 18:36:43.787767399 -0400 @@ -51,8 +51,12 @@ #include "runtime/vmThread.hpp" #include "runtime/vm_operations.hpp" #include "services/memoryService.hpp" +#include "utilities/dtrace.hpp" #include "utilities/stack.inline.hpp" =20 +#ifndef USDT2 + HS_DTRACE_PROBE_DECL2(provider, name, *uintptr_t, *uintptr_t); +#endif /* !USDT2 */ =20 HeapWord* PSScavenge::_to_space_top_before_gc =3D NULL; int PSScavenge::_consecutive_skipped_scavenges =3D = 0; @@ -226,7 +230,13 @@ PSAdaptiveSizePolicy* policy =3D heap->size_policy(); IsGCActiveMark mark; =20 +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__begin, *heap, heap= ->gc_cause()); +#endif /* !USDT2 */ const bool scavenge_done =3D PSScavenge::invoke_no_policy(); +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSScavenge__end, *heap, heap->= gc_cause()); +#endif /* !USDT2 */ const bool need_full_gc =3D !scavenge_done || policy->should_full_GC(heap->old_gen()->free_in_bytes()); bool full_gc_done =3D false; @@ -243,9 +253,27 @@ const bool clear_all_softrefs =3D cp->should_clear_all_soft_refs(); =20 if (UseParallelOldGC) { +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__begin, *hea= p, heap->gc_cause());=20 +#endif /* !USDT2 */ + full_gc_done =3D PSParallelCompact::invoke_no_policy(clear_all_softr= efs); + +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSParallelCompact__end, *heap,= heap->gc_cause()); +#endif /* !USDT2 */ + } else { + +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__begin, *heap, hea= p->gc_cause()); +#endif /* !USDT2 */ + full_gc_done =3D PSMarkSweep::invoke_no_policy(clear_all_softrefs); + +#ifndef USDT2 + HS_DTRACE_PROBE2(hotspot, gc__collection__PSMarkSweep__end, *heap, heap-= >gc_cause()); +#endif /* !USDT2 */ } } =20 --PNTmBPCT7hxwcZjr-- --kORqDWCi7qDJ0mEj Content-Type: application/pgp-signature Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJQGnxPAAoJEAaRCclx+kwJez8P/2iT6Ma4sNbzHqLqvI40M0zX 1s/pfKaMFVjfyLuyT1OMEQ3q1LLguDgu84av1/HUG2x/fq+3cvgHw+hAn4ktdzO3 wzoOk63FMG/O8+2JmJpkYRe4W6EiDpSqaky/JIDqHvHu4khK4lRilcfDb8GspEQg f0INjR5d6uPZsg/Q7jVBz1wDm1kolbeGqLjpYvOyTpFiwqivZnw9GQI+nyAcoZYz a+DVZyObivcta/9e9gaDo06aGFxdCWcOBYXof3tImU0ePvTmyFNWU3u/Ynagi3dM vc+w8OkcJac0/M0BIY5ZAZYBSxqJQzt57NvW1x5Xy6j0DB3nj3ncHP+fK2I8lv5m GP7l7xwclfk2IwYbnHfSyWEJr51Jdh8zwdX67saOX8VOwkCj6PY0Ai4bkAdPNQIS 5r/YNyBMnYjkc6/wCGKNrVY25AuANsxE44Z/rYxaIC61zvlR7dmrJzF53gh3L7sr tXb9tYiucrXK7wfoZASOyWpHZGbOdjgUrksDHJ5GG3/yYK5oIJwfVRkNMl8Fi2kA Zc4UyRdCKdIKHOjvMHHfS1ohCVC9l7mUDkZKJ1Q0471eoa2bjYvLk7u6y3xyWh26 Rz5CMPGfmfFoO4Ys+NOfp8O3oePf0cppMEoxRjXZBBGiV1Oj1M2HwUVU7BsYmFLk mKdiiP6IjU7/esIAcylO =M+IQ -----END PGP SIGNATURE----- --kORqDWCi7qDJ0mEj--