129 // Double parameter format strings |
129 // Double parameter format strings |
130 #define ergo_format_byte_perc(_name_) \ |
130 #define ergo_format_byte_perc(_name_) \ |
131 ", " _name_ ": "SIZE_FORMAT" bytes (%1.2f %%)" |
131 ", " _name_ ": "SIZE_FORMAT" bytes (%1.2f %%)" |
132 |
132 |
133 // Generates the format string |
133 // Generates the format string |
134 #define ergo_format(_action_, _extra_format_) \ |
134 #define ergo_format(_extra_format_) \ |
135 " %1.3f: [G1Ergonomics (%s) " _action_ _extra_format_ "]" |
135 " %1.3f: [G1Ergonomics (%s) %s" _extra_format_ "]" |
136 |
136 |
137 // Conditionally, prints an ergonomic decision record. _extra_format_ |
137 // Conditionally, prints an ergonomic decision record. _extra_format_ |
138 // is the format string for the optional items we'd like to print |
138 // is the format string for the optional items we'd like to print |
139 // (i.e., the decision's reason and any associated values). This |
139 // (i.e., the decision's reason and any associated values). This |
140 // string should be built up using the ergo_*_format macros (see |
140 // string should be built up using the ergo_*_format macros (see |
143 // Since we cannot rely on the compiler supporting variable argument |
143 // Since we cannot rely on the compiler supporting variable argument |
144 // macros, this macro accepts a fixed number of arguments and passes |
144 // macros, this macro accepts a fixed number of arguments and passes |
145 // them to the print method. For convenience, we have wrapper macros |
145 // them to the print method. For convenience, we have wrapper macros |
146 // below which take a specific number of arguments and set the rest to |
146 // below which take a specific number of arguments and set the rest to |
147 // a default value. |
147 // a default value. |
148 #define ergo_verbose_common(_tag_, _action_, _extra_format_, \ |
148 #define ergo_verbose_common(_tag_, _action_, _extra_format_, \ |
149 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ |
149 _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ |
150 do { \ |
150 do { \ |
151 if (G1ErgoVerbose::enabled((_tag_))) { \ |
151 if (G1ErgoVerbose::enabled((_tag_))) { \ |
152 gclog_or_tty->print_cr(ergo_format(_action_, _extra_format_), \ |
152 gclog_or_tty->print_cr(ergo_format(_extra_format_), \ |
153 os::elapsedTime(), \ |
153 os::elapsedTime(), \ |
154 G1ErgoVerbose::to_string((_tag_)), \ |
154 G1ErgoVerbose::to_string((_tag_)), \ |
155 (_arg0_), (_arg1_), (_arg2_), \ |
155 (_action_), \ |
156 (_arg3_), (_arg4_), (_arg5_)); \ |
156 (_arg0_), (_arg1_), (_arg2_), \ |
157 } \ |
157 (_arg3_), (_arg4_), (_arg5_)); \ |
|
158 } \ |
158 } while (0) |
159 } while (0) |
159 |
160 |
160 |
161 |
161 #define ergo_verbose(_tag_, _action_) \ |
162 #define ergo_verbose(_tag_, _action_) \ |
162 ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0) |
163 ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0) |
163 |
164 |
164 #define ergo_verbose0(_tag_, _action_, _extra_format_) \ |
165 #define ergo_verbose0(_tag_, _action_, _extra_format_) \ |
165 ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0) |
166 ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0) |
166 |
167 |