< prev index next >

src/hotspot/share/gc/g1/g1Trace.cpp

Print this page
rev 56145 : 8230431: Move G1 trace code from gcTrace* to G1 directory
Reviewed-by:
rev 56146 : 8209802: Garbage collectors should register JFR types themselves to avoid build errors.


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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/g1/g1EvacuationInfo.hpp"

  27 #include "gc/g1/g1Trace.hpp"
  28 #include "gc/g1/g1YCTypes.hpp"
  29 #include "gc/shared/gcHeapSummary.hpp"
  30 #include "jfr/jfrEvents.hpp"










































  31 
  32 void G1NewTracer::report_yc_type(G1YCType type) {
  33   _g1_young_gc_info.set_type(type);
  34 }
  35 
  36 void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
  37   YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);
  38   send_g1_young_gc_event();
  39 }
  40 
  41 void G1NewTracer::report_evacuation_info(G1EvacuationInfo* info) {
  42   send_evacuation_info_event(info);
  43 }
  44 
  45 void G1NewTracer::report_evacuation_failed(EvacuationFailedInfo& ef_info) {
  46   send_evacuation_failed_event(ef_info);
  47   ef_info.reset();
  48 }
  49 
  50 void G1NewTracer::report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const {




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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/g1/g1EvacuationInfo.hpp"
  27 #include "gc/g1/g1HeapRegionTraceType.hpp"
  28 #include "gc/g1/g1Trace.hpp"
  29 #include "gc/g1/g1YCTypes.hpp"
  30 #include "gc/shared/gcHeapSummary.hpp"
  31 #include "jfr/jfrEvents.hpp"
  32 #if INCLUDE_JFR
  33 #include "jfr/metadata/jfrSerializer.hpp"
  34 #endif
  35 
  36 #if INCLUDE_JFR
  37 class G1HeapRegionTypeConstant : public JfrSerializer {
  38 public:
  39   void serialize(JfrCheckpointWriter& writer) {
  40   static const u4 nof_entries = G1HeapRegionTraceType::G1HeapRegionTypeEndSentinel;
  41   writer.write_count(nof_entries);
  42   for (u4 i = 0; i < nof_entries; ++i) {
  43     writer.write_key(i);
  44     writer.write(G1HeapRegionTraceType::to_string((G1HeapRegionTraceType::Type)i));
  45   }
  46 }
  47 };
  48 
  49 class G1YCTypeConstant : public JfrSerializer {
  50 public:
  51   void serialize(JfrCheckpointWriter& writer) {
  52     static const u4 nof_entries = G1YCTypeEndSentinel;
  53     writer.write_count(nof_entries);
  54     for (u4 i = 0; i < nof_entries; ++i) {
  55       writer.write_key(i);
  56       writer.write(G1YCTypeHelper::to_string((G1YCType)i));
  57     }
  58   }
  59 };
  60 
  61 static void register_jfr_type_constants() {
  62   JfrSerializer::register_serializer(TYPE_G1HEAPREGIONTYPE, false, true,
  63                                      new G1HeapRegionTypeConstant());
  64 
  65   JfrSerializer::register_serializer(TYPE_G1YCTYPE, false, true,
  66                                      new G1YCTypeConstant());
  67 }
  68 
  69 #endif
  70 
  71 void G1NewTracer::initialize() {
  72   JFR_ONLY(register_jfr_type_constants());
  73 }
  74 
  75 void G1NewTracer::report_yc_type(G1YCType type) {
  76   _g1_young_gc_info.set_type(type);
  77 }
  78 
  79 void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
  80   YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);
  81   send_g1_young_gc_event();
  82 }
  83 
  84 void G1NewTracer::report_evacuation_info(G1EvacuationInfo* info) {
  85   send_evacuation_info_event(info);
  86 }
  87 
  88 void G1NewTracer::report_evacuation_failed(EvacuationFailedInfo& ef_info) {
  89   send_evacuation_failed_event(ef_info);
  90   ef_info.reset();
  91 }
  92 
  93 void G1NewTracer::report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const {


< prev index next >