annotate src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp @ 20652:e8bf410d5e23

8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs Summary: Read _top before _gc_time_stamp in saved_mark_word() with LoadLoad order to ensure we get a consistent view Reviewed-by: brutisso, dcubed, dholmes, stefank
author mgerdin
date Fri, 14 Nov 2014 14:23:25 +0100
parents 7383557659bd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
1 /*
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 4912
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
4 *
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
7 * published by the Free Software Foundation.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
8 *
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
13 * accompanied this code).
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
14 *
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
18 *
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
21 * questions.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
22 *
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
23 */
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
24
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
27
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
28 #include "memory/allocation.hpp"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
29 #include "utilities/debug.hpp"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
30
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
31 // The log of G1's heuristic decisions comprises of a series of
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
32 // records which have a similar format in order to maintain
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
33 // consistency across records and ultimately easier parsing of the
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
34 // output, if we ever choose to do that. Each record consists of:
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
35 // * A time stamp to be able to easily correlate each record with
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
36 // other events.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
37 // * A unique string to allow us to easily identify such records.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
38 // * The name of the heuristic the record corresponds to.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
39 // * An action string which describes the action that G1 did or is
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
40 // about to do.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
41 // * An optional reason string which describes the reason for the
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
42 // action.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
43 // * An optional number of name/value pairs which contributed to the
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
44 // decision to take the action described in the record.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
45 //
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
46 // Each record is associated with a "tag" which is the combination of
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
47 // the heuristic the record corresponds to, as well as the min level
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
48 // of verboseness at which the record should be printed. The tag is
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
49 // checked against the current settings to determine whether the record
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
50 // should be printed or not.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
51
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
52 // The available verboseness levels.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
53 typedef enum {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
54 // Determine which part of the tag is occupied by the level.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
55 ErgoLevelShift = 8,
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
56 ErgoLevelMask = ~((1 << ErgoLevelShift) - 1),
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
57
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
58 // ErgoLow is 0 so that we don't have to explicitly or a heuristic
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
59 // id with ErgoLow to keep its use simpler.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
60 ErgoLow = 0,
3927
f1b4e0e0bdad 7089625: G1: policy for how many old regions to add to the CSet (when young gen is fixed) is broken
tonyp
parents: 3914
diff changeset
61 ErgoHigh = 1 << ErgoLevelShift
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
62 } ErgoLevel;
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
63
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
64 // The available heuristics.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
65 typedef enum {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
66 // Determines which part of the tag is occupied by the heuristic id.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
67 ErgoHeuristicMask = ~ErgoLevelMask,
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
68
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
69 ErgoHeapSizing = 0,
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
70 ErgoCSetConstruction,
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
71 ErgoConcCycles,
4710
41406797186b 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 3927
diff changeset
72 ErgoMixedGCs,
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
73
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
74 ErgoHeuristicNum
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
75 } ErgoHeuristic;
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
76
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
77 class G1ErgoVerbose : AllStatic {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
78 private:
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
79 // Determines the minimum verboseness level at which records will be
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
80 // printed.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
81 static ErgoLevel _level;
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
82 // Determines which heuristics are currently enabled.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
83 static bool _enabled[ErgoHeuristicNum];
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
84
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
85 static ErgoLevel extract_level(int tag) {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
86 return (ErgoLevel) (tag & ErgoLevelMask);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
87 }
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
88
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
89 static ErgoHeuristic extract_heuristic(int tag) {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
90 return (ErgoHeuristic) (tag & ErgoHeuristicMask);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
91 }
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
92
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
93 public:
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
94 // Needs to be explicitly called at GC initialization.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
95 static void initialize();
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
96
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
97 static void set_level(ErgoLevel level);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
98 static void set_enabled(ErgoHeuristic h, bool enabled);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
99 // It is applied to all heuristics.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
100 static void set_enabled(bool enabled);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
101
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
102 static bool enabled(int tag) {
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
103 ErgoLevel level = extract_level(tag);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
104 ErgoHeuristic n = extract_heuristic(tag);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
105 return level <= _level && _enabled[n];
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
106 }
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
107
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
108 // Extract the heuristic id from the tag and return a string with
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
109 // its name.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
110 static const char* to_string(int tag);
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
111 };
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
112
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
113 // The macros below generate the format string for values of different
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
114 // types and/or metrics.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
115
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
116 // The reason for the action is optional and is handled specially: the
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
117 // reason string is concatenated here so it's not necessary to pass it
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
118 // as a parameter.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
119 #define ergo_format_reason(_reason_) ", reason: " _reason_
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
120
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
121 // Single parameter format strings
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
122 #define ergo_format_str(_name_) ", " _name_ ": %s"
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 4912
diff changeset
123 #define ergo_format_region(_name_) ", " _name_ ": %u regions"
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
124 #define ergo_format_byte(_name_) ", " _name_ ": "SIZE_FORMAT" bytes"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
125 #define ergo_format_double(_name_) ", " _name_ ": %1.2f"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
126 #define ergo_format_perc(_name_) ", " _name_ ": %1.2f %%"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
127 #define ergo_format_ms(_name_) ", " _name_ ": %1.2f ms"
6611
7383557659bd 7185699: G1: Prediction model discrepancies
johnc
parents: 6010
diff changeset
128 #define ergo_format_size(_name_) ", " _name_ ": "SIZE_FORMAT
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
129
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
130 // Double parameter format strings
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
131 #define ergo_format_byte_perc(_name_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
132 ", " _name_ ": "SIZE_FORMAT" bytes (%1.2f %%)"
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
133
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
134 // Generates the format string
4912
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
135 #define ergo_format(_extra_format_) \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
136 " %1.3f: [G1Ergonomics (%s) %s" _extra_format_ "]"
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
137
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
138 // Conditionally, prints an ergonomic decision record. _extra_format_
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
139 // is the format string for the optional items we'd like to print
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
140 // (i.e., the decision's reason and any associated values). This
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
141 // string should be built up using the ergo_*_format macros (see
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
142 // above) to ensure consistency.
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
143 //
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
144 // Since we cannot rely on the compiler supporting variable argument
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
145 // macros, this macro accepts a fixed number of arguments and passes
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
146 // them to the print method. For convenience, we have wrapper macros
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
147 // below which take a specific number of arguments and set the rest to
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
148 // a default value.
4912
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
149 #define ergo_verbose_common(_tag_, _action_, _extra_format_, \
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
150 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \
4912
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
151 do { \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
152 if (G1ErgoVerbose::enabled((_tag_))) { \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
153 gclog_or_tty->print_cr(ergo_format(_extra_format_), \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
154 os::elapsedTime(), \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
155 G1ErgoVerbose::to_string((_tag_)), \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
156 (_action_), \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
157 (_arg0_), (_arg1_), (_arg2_), \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
158 (_arg3_), (_arg4_), (_arg5_)); \
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
159 } \
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
160 } while (0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
161
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
162
4912
a9647476d1a4 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 4710
diff changeset
163 #define ergo_verbose(_tag_, _action_) \
3914
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
164 ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
165
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
166 #define ergo_verbose0(_tag_, _action_, _extra_format_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
167 ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
168
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
169 #define ergo_verbose1(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
170 _arg0_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
171 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
172 _arg0_, 0, 0, 0, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
173
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
174 #define ergo_verbose2(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
175 _arg0_, _arg1_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
176 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
177 _arg0_, _arg1_, 0, 0, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
178
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
179 #define ergo_verbose3(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
180 _arg0_, _arg1_, _arg2_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
181 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
182 _arg0_, _arg1_, _arg2_, 0, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
183
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
184 #define ergo_verbose4(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
185 _arg0_, _arg1_, _arg2_, _arg3_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
186 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
187 _arg0_, _arg1_, _arg2_, _arg3_, 0, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
188
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
189 #define ergo_verbose5(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
190 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
191 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
192 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, 0)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
193
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
194 #define ergo_verbose6(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
195 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
196 ergo_verbose_common(_tag_, _action_, _extra_format_, \
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
197 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_)
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
198
20213c8a3c40 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
199 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP