src/share/vm/gc_implementation/g1/g1HRPrinter.cpp

Mon, 19 Aug 2019 10:11:31 +0200

author
neugens
date
Mon, 19 Aug 2019 10:11:31 +0200
changeset 9861
a248d0be1309
parent 9327
f96fcd9e1e1b
child 9448
73d689add964
permissions
-rw-r--r--

8229401: Fix JFR code cache test failures
8223689: Add JFR Thread Sampling Support
8223690: Add JFR BiasedLock Event Support
8223691: Add JFR G1 Region Type Change Event Support
8223692: Add JFR G1 Heap Summary Event Support
Summary: Backport JFR from JDK11, additional fixes
Reviewed-by: neugens, apetushkov
Contributed-by: denghui.ddh@alibaba-inc.com

tonyp@2975 1 /*
drchase@6680 2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
tonyp@2975 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tonyp@2975 4 *
tonyp@2975 5 * This code is free software; you can redistribute it and/or modify it
tonyp@2975 6 * under the terms of the GNU General Public License version 2 only, as
tonyp@2975 7 * published by the Free Software Foundation.
tonyp@2975 8 *
tonyp@2975 9 * This code is distributed in the hope that it will be useful, but WITHOUT
tonyp@2975 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
tonyp@2975 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
tonyp@2975 12 * version 2 for more details (a copy is included in the LICENSE file that
tonyp@2975 13 * accompanied this code).
tonyp@2975 14 *
tonyp@2975 15 * You should have received a copy of the GNU General Public License version
tonyp@2975 16 * 2 along with this work; if not, write to the Free Software Foundation,
tonyp@2975 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
tonyp@2975 18 *
tonyp@2975 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
tonyp@2975 20 * or visit www.oracle.com if you need additional information or have any
tonyp@2975 21 * questions.
tonyp@2975 22 *
tonyp@2975 23 */
tonyp@2975 24
tonyp@2975 25 #include "precompiled.hpp"
tonyp@2975 26 #include "gc_implementation/g1/g1HRPrinter.hpp"
tonyp@2975 27 #include "gc_implementation/g1/heapRegion.hpp"
tonyp@2975 28 #include "utilities/ostream.hpp"
tonyp@2975 29
drchase@6680 30 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
drchase@6680 31
tonyp@2975 32 const char* G1HRPrinter::action_name(ActionType action) {
tonyp@2975 33 switch(action) {
tonyp@2975 34 case Alloc: return "ALLOC";
tonyp@2975 35 case AllocForce: return "ALLOC-FORCE";
tonyp@2975 36 case Retire: return "RETIRE";
tonyp@2975 37 case Reuse: return "REUSE";
tonyp@2975 38 case CSet: return "CSET";
tonyp@2975 39 case EvacFailure: return "EVAC-FAILURE";
tonyp@2975 40 case Cleanup: return "CLEANUP";
tonyp@2975 41 case PostCompaction: return "POST-COMPACTION";
tonyp@2975 42 case Commit: return "COMMIT";
tonyp@2975 43 case Uncommit: return "UNCOMMIT";
tonyp@2975 44 default: ShouldNotReachHere();
tonyp@2975 45 }
tonyp@2975 46 // trying to keep the Windows compiler happy
tonyp@2975 47 return NULL;
tonyp@2975 48 }
tonyp@2975 49
tonyp@2975 50 const char* G1HRPrinter::region_type_name(RegionType type) {
tonyp@2975 51 switch (type) {
tonyp@2975 52 case Unset: return NULL;
tonyp@2975 53 case Eden: return "Eden";
tonyp@2975 54 case Survivor: return "Survivor";
tonyp@2975 55 case Old: return "Old";
tonyp@2975 56 case SingleHumongous: return "SingleH";
tonyp@2975 57 case StartsHumongous: return "StartsH";
tonyp@2975 58 case ContinuesHumongous: return "ContinuesH";
tonyp@2975 59 default: ShouldNotReachHere();
tonyp@2975 60 }
tonyp@2975 61 // trying to keep the Windows compiler happy
tonyp@2975 62 return NULL;
tonyp@2975 63 }
tonyp@2975 64
tonyp@2975 65 const char* G1HRPrinter::phase_name(PhaseType phase) {
tonyp@2975 66 switch (phase) {
tonyp@2975 67 case StartGC: return "StartGC";
tonyp@2975 68 case EndGC: return "EndGC";
tonyp@2975 69 case StartFullGC: return "StartFullGC";
tonyp@2975 70 case EndFullGC: return "EndFullGC";
tonyp@2975 71 default: ShouldNotReachHere();
tonyp@2975 72 }
tonyp@2975 73 // trying to keep the Windows compiler happy
tonyp@2975 74 return NULL;
tonyp@2975 75 }
tonyp@2975 76
tonyp@2975 77 #define G1HR_PREFIX " G1HR"
tonyp@2975 78
tonyp@2975 79 void G1HRPrinter::print(ActionType action, RegionType type,
tonyp@2975 80 HeapRegion* hr, HeapWord* top) {
tonyp@2975 81 const char* action_str = action_name(action);
tonyp@2975 82 const char* type_str = region_type_name(type);
tonyp@2975 83 HeapWord* bottom = hr->bottom();
tonyp@2975 84
tonyp@2975 85 if (type_str != NULL) {
tonyp@2975 86 if (top != NULL) {
kevinw@9327 87 gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT " " PTR_FORMAT,
tonyp@2975 88 action_str, type_str, bottom, top);
tonyp@2975 89 } else {
kevinw@9327 90 gclog_or_tty->print_cr(G1HR_PREFIX " %s(%s) " PTR_FORMAT,
tonyp@2975 91 action_str, type_str, bottom);
tonyp@2975 92 }
tonyp@2975 93 } else {
tonyp@2975 94 if (top != NULL) {
kevinw@9327 95 gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT " " PTR_FORMAT,
tonyp@2975 96 action_str, bottom, top);
tonyp@2975 97 } else {
kevinw@9327 98 gclog_or_tty->print_cr(G1HR_PREFIX " %s " PTR_FORMAT,
tonyp@2975 99 action_str, bottom);
tonyp@2975 100 }
tonyp@2975 101 }
tonyp@2975 102 }
tonyp@2975 103
tonyp@2975 104 void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
tonyp@2975 105 const char* action_str = action_name(action);
tonyp@2975 106
kevinw@9327 107 gclog_or_tty->print_cr(G1HR_PREFIX " %s [" PTR_FORMAT "," PTR_FORMAT "]",
tonyp@2975 108 action_str, bottom, end);
tonyp@2975 109 }
tonyp@2975 110
tonyp@2975 111 void G1HRPrinter::print(PhaseType phase, size_t phase_num) {
tonyp@2975 112 const char* phase_str = phase_name(phase);
kevinw@9327 113 gclog_or_tty->print_cr(G1HR_PREFIX " #%s " SIZE_FORMAT, phase_str, phase_num);
tonyp@2975 114 }

mercurial