1050 } 1051 1052 // 1053 // Stat load 1054 // 1055 void ZStatLoad::print() { 1056 double loadavg[3] = {}; 1057 os::loadavg(loadavg, ARRAY_SIZE(loadavg)); 1058 log_info(gc, load)("Load: %.2f/%.2f/%.2f", loadavg[0], loadavg[1], loadavg[2]); 1059 } 1060 1061 // 1062 // Stat mark 1063 // 1064 size_t ZStatMark::_nstripes; 1065 size_t ZStatMark::_nproactiveflush; 1066 size_t ZStatMark::_nterminateflush; 1067 size_t ZStatMark::_ntrycomplete; 1068 size_t ZStatMark::_ncontinue; 1069 1070 void ZStatMark::print() { 1071 log_info(gc, marking)("Mark: " 1072 SIZE_FORMAT " stripe(s), " 1073 SIZE_FORMAT " proactive flush(es), " 1074 SIZE_FORMAT " terminate flush(es), " 1075 SIZE_FORMAT " completion(s), " 1076 SIZE_FORMAT " continuation(s) ", 1077 _nstripes, 1078 _nproactiveflush, 1079 _nterminateflush, 1080 _ntrycomplete, 1081 _ncontinue); 1082 } 1083 1084 // 1085 // Stat relocation 1086 // 1087 size_t ZStatRelocation::_relocating; 1088 bool ZStatRelocation::_success; 1089 1090 void ZStatRelocation::print() { 1091 if (_success) { 1092 log_info(gc, reloc)("Relocation: Successful, " SIZE_FORMAT "M relocated", _relocating / M); 1093 } else { 1094 log_info(gc, reloc)("Relocation: Incomplete"); 1095 } 1096 } 1097 1098 // 1099 // Stat nmethods 1100 // 1101 void ZStatNMethods::print() { 1102 log_info(gc, nmethod)("NMethods: " SIZE_FORMAT " registered, " SIZE_FORMAT " unregistered", 1103 ZNMethodTable::registered_nmethods(), 1104 ZNMethodTable::unregistered_nmethods()); 1105 } 1106 1107 // 1108 // Stat references 1109 // 1110 ZStatReferences::ZCount ZStatReferences::_soft; 1111 ZStatReferences::ZCount ZStatReferences::_weak; 1112 ZStatReferences::ZCount ZStatReferences::_final; 1113 ZStatReferences::ZCount ZStatReferences::_phantom; 1114 1115 void ZStatReferences::print(const char* name, const ZStatReferences::ZCount& ref) { 1116 log_info(gc, ref)("%s: " 1117 SIZE_FORMAT " encountered, " 1118 SIZE_FORMAT " discovered, " 1119 SIZE_FORMAT " dropped, " 1120 SIZE_FORMAT " enqueued", 1121 name, 1122 ref.encountered, 1123 ref.discovered, 1124 ref.dropped, 1125 ref.enqueued); 1126 } 1127 1128 void ZStatReferences::print() { 1129 print("Soft", _soft); 1130 print("Weak", _weak); 1131 print("Final", _final); 1132 print("Phantom", _phantom); 1133 } 1134 1135 // 1136 // Stat heap 1137 // 1138 ZStatHeap::ZAtInitialize ZStatHeap::_at_initialize; 1139 ZStatHeap::ZAtMarkStart ZStatHeap::_at_mark_start; 1140 ZStatHeap::ZAtMarkEnd ZStatHeap::_at_mark_end; 1141 ZStatHeap::ZAtRelocateStart ZStatHeap::_at_relocate_start; 1142 ZStatHeap::ZAtRelocateEnd ZStatHeap::_at_relocate_end; 1143 1144 #define ZSIZE_NA "%9s", "-" 1145 #define ZSIZE_ARGS(size) SIZE_FORMAT_W(8) "M (%.0lf%%)", \ 1146 ((size) / M), (percent_of<size_t>(size, _at_initialize.max_capacity)) 1147 1148 void ZStatHeap::print() { 1149 ZStatTablePrinter table(10, 18); 1150 log_info(gc, heap)("%s", table() 1151 .fill() 1152 .center("Mark Start") 1153 .center("Mark End") 1154 .center("Relocate Start") 1155 .center("Relocate End") 1156 .center("High") 1157 .center("Low") 1158 .end()); 1159 log_info(gc, heap)("%s", table() 1160 .right("Capacity:") 1161 .left(ZSIZE_ARGS(_at_mark_start.capacity)) 1162 .left(ZSIZE_ARGS(_at_mark_end.capacity)) 1163 .left(ZSIZE_ARGS(_at_relocate_start.capacity)) 1164 .left(ZSIZE_ARGS(_at_relocate_end.capacity)) 1165 .left(ZSIZE_ARGS(_at_relocate_end.capacity_high)) 1166 .left(ZSIZE_ARGS(_at_relocate_end.capacity_low)) | 1050 } 1051 1052 // 1053 // Stat load 1054 // 1055 void ZStatLoad::print() { 1056 double loadavg[3] = {}; 1057 os::loadavg(loadavg, ARRAY_SIZE(loadavg)); 1058 log_info(gc, load)("Load: %.2f/%.2f/%.2f", loadavg[0], loadavg[1], loadavg[2]); 1059 } 1060 1061 // 1062 // Stat mark 1063 // 1064 size_t ZStatMark::_nstripes; 1065 size_t ZStatMark::_nproactiveflush; 1066 size_t ZStatMark::_nterminateflush; 1067 size_t ZStatMark::_ntrycomplete; 1068 size_t ZStatMark::_ncontinue; 1069 1070 void ZStatMark::set_at_mark_start(size_t nstripes) { 1071 _nstripes = nstripes; 1072 } 1073 1074 void ZStatMark::set_at_mark_end(size_t nproactiveflush, 1075 size_t nterminateflush, 1076 size_t ntrycomplete, 1077 size_t ncontinue) { 1078 _nproactiveflush = nproactiveflush; 1079 _nterminateflush = nterminateflush; 1080 _ntrycomplete = ntrycomplete; 1081 _ncontinue = ncontinue; 1082 } 1083 1084 void ZStatMark::print() { 1085 log_info(gc, marking)("Mark: " 1086 SIZE_FORMAT " stripe(s), " 1087 SIZE_FORMAT " proactive flush(es), " 1088 SIZE_FORMAT " terminate flush(es), " 1089 SIZE_FORMAT " completion(s), " 1090 SIZE_FORMAT " continuation(s) ", 1091 _nstripes, 1092 _nproactiveflush, 1093 _nterminateflush, 1094 _ntrycomplete, 1095 _ncontinue); 1096 } 1097 1098 // 1099 // Stat relocation 1100 // 1101 size_t ZStatRelocation::_relocating; 1102 bool ZStatRelocation::_success; 1103 1104 void ZStatRelocation::set_at_select_relocation_set(size_t relocating) { 1105 _relocating = relocating; 1106 } 1107 1108 void ZStatRelocation::set_at_relocate_end(bool success) { 1109 _success = success; 1110 } 1111 1112 void ZStatRelocation::print() { 1113 if (_success) { 1114 log_info(gc, reloc)("Relocation: Successful, " SIZE_FORMAT "M relocated", _relocating / M); 1115 } else { 1116 log_info(gc, reloc)("Relocation: Incomplete"); 1117 } 1118 } 1119 1120 // 1121 // Stat nmethods 1122 // 1123 void ZStatNMethods::print() { 1124 log_info(gc, nmethod)("NMethods: " SIZE_FORMAT " registered, " SIZE_FORMAT " unregistered", 1125 ZNMethodTable::registered_nmethods(), 1126 ZNMethodTable::unregistered_nmethods()); 1127 } 1128 1129 // 1130 // Stat references 1131 // 1132 ZStatReferences::ZCount ZStatReferences::_soft; 1133 ZStatReferences::ZCount ZStatReferences::_weak; 1134 ZStatReferences::ZCount ZStatReferences::_final; 1135 ZStatReferences::ZCount ZStatReferences::_phantom; 1136 1137 void ZStatReferences::set(ZCount* count, size_t encountered, size_t dropped, size_t enqueued) { 1138 count->encountered = encountered; 1139 count->discovered = dropped + enqueued; 1140 count->dropped = dropped; 1141 count->enqueued = enqueued; 1142 } 1143 1144 void ZStatReferences::set_soft(size_t encountered, size_t dropped, size_t enqueued) { 1145 set(&_soft, encountered, dropped, enqueued); 1146 } 1147 1148 void ZStatReferences::set_weak(size_t encountered, size_t dropped, size_t enqueued) { 1149 set(&_weak, encountered, dropped, enqueued); 1150 } 1151 1152 void ZStatReferences::set_final(size_t encountered, size_t dropped, size_t enqueued) { 1153 set(&_final, encountered, dropped, enqueued); 1154 } 1155 1156 void ZStatReferences::set_phantom(size_t encountered, size_t dropped, size_t enqueued) { 1157 set(&_phantom, encountered, dropped, enqueued); 1158 } 1159 1160 void ZStatReferences::print(const char* name, const ZStatReferences::ZCount& ref) { 1161 log_info(gc, ref)("%s: " 1162 SIZE_FORMAT " encountered, " 1163 SIZE_FORMAT " discovered, " 1164 SIZE_FORMAT " dropped, " 1165 SIZE_FORMAT " enqueued", 1166 name, 1167 ref.encountered, 1168 ref.discovered, 1169 ref.dropped, 1170 ref.enqueued); 1171 } 1172 1173 void ZStatReferences::print() { 1174 print("Soft", _soft); 1175 print("Weak", _weak); 1176 print("Final", _final); 1177 print("Phantom", _phantom); 1178 } 1179 1180 // 1181 // Stat heap 1182 // 1183 ZStatHeap::ZAtInitialize ZStatHeap::_at_initialize; 1184 ZStatHeap::ZAtMarkStart ZStatHeap::_at_mark_start; 1185 ZStatHeap::ZAtMarkEnd ZStatHeap::_at_mark_end; 1186 ZStatHeap::ZAtRelocateStart ZStatHeap::_at_relocate_start; 1187 ZStatHeap::ZAtRelocateEnd ZStatHeap::_at_relocate_end; 1188 1189 #define ZSIZE_NA "%9s", "-" 1190 #define ZSIZE_ARGS(size) SIZE_FORMAT_W(8) "M (%.0lf%%)", \ 1191 ((size) / M), (percent_of<size_t>(size, _at_initialize.max_capacity)) 1192 1193 size_t ZStatHeap::available(size_t used) { 1194 return _at_initialize.max_capacity - used; 1195 } 1196 1197 size_t ZStatHeap::reserve(size_t used) { 1198 return MIN2(_at_initialize.max_reserve, available(used)); 1199 } 1200 1201 size_t ZStatHeap::free(size_t used) { 1202 return available(used) - reserve(used); 1203 } 1204 1205 void ZStatHeap::set_at_initialize(size_t max_capacity, 1206 size_t max_reserve) { 1207 _at_initialize.max_capacity = max_capacity; 1208 _at_initialize.max_reserve = max_reserve; 1209 } 1210 1211 void ZStatHeap::set_at_mark_start(size_t capacity, 1212 size_t used) { 1213 _at_mark_start.capacity = capacity; 1214 _at_mark_start.reserve = reserve(used); 1215 _at_mark_start.used = used; 1216 _at_mark_start.free = free(used); 1217 } 1218 1219 void ZStatHeap::set_at_mark_end(size_t capacity, 1220 size_t allocated, 1221 size_t used) { 1222 _at_mark_end.capacity = capacity; 1223 _at_mark_end.reserve = reserve(used); 1224 _at_mark_end.allocated = allocated; 1225 _at_mark_end.used = used; 1226 _at_mark_end.free = free(used); 1227 } 1228 1229 void ZStatHeap::set_at_select_relocation_set(size_t live, 1230 size_t garbage, 1231 size_t reclaimed) { 1232 _at_mark_end.live = live; 1233 _at_mark_end.garbage = garbage; 1234 1235 _at_relocate_start.garbage = garbage - reclaimed; 1236 _at_relocate_start.reclaimed = reclaimed; 1237 } 1238 1239 void ZStatHeap::set_at_relocate_start(size_t capacity, 1240 size_t allocated, 1241 size_t used) { 1242 _at_relocate_start.capacity = capacity; 1243 _at_relocate_start.reserve = reserve(used); 1244 _at_relocate_start.allocated = allocated; 1245 _at_relocate_start.used = used; 1246 _at_relocate_start.free = free(used); 1247 } 1248 1249 void ZStatHeap::set_at_relocate_end(size_t capacity, 1250 size_t allocated, 1251 size_t reclaimed, 1252 size_t used, 1253 size_t used_high, 1254 size_t used_low) { 1255 _at_relocate_end.capacity = capacity; 1256 _at_relocate_end.capacity_high = capacity; 1257 _at_relocate_end.capacity_low = _at_mark_start.capacity; 1258 _at_relocate_end.reserve = reserve(used); 1259 _at_relocate_end.reserve_high = reserve(used_high); 1260 _at_relocate_end.reserve_low = reserve(used_low); 1261 _at_relocate_end.garbage = _at_mark_end.garbage - reclaimed; 1262 _at_relocate_end.allocated = allocated; 1263 _at_relocate_end.reclaimed = reclaimed; 1264 _at_relocate_end.used = used; 1265 _at_relocate_end.used_high = used_high; 1266 _at_relocate_end.used_low = used_low; 1267 _at_relocate_end.free = free(used); 1268 _at_relocate_end.free_high = free(used_low); 1269 _at_relocate_end.free_low = free(used_high); 1270 } 1271 1272 size_t ZStatHeap::max_capacity() { 1273 return _at_initialize.max_capacity; 1274 } 1275 1276 size_t ZStatHeap::used_at_mark_start() { 1277 return _at_mark_start.used; 1278 } 1279 1280 size_t ZStatHeap::used_at_relocate_end() { 1281 return _at_relocate_end.used; 1282 } 1283 1284 void ZStatHeap::print() { 1285 ZStatTablePrinter table(10, 18); 1286 log_info(gc, heap)("%s", table() 1287 .fill() 1288 .center("Mark Start") 1289 .center("Mark End") 1290 .center("Relocate Start") 1291 .center("Relocate End") 1292 .center("High") 1293 .center("Low") 1294 .end()); 1295 log_info(gc, heap)("%s", table() 1296 .right("Capacity:") 1297 .left(ZSIZE_ARGS(_at_mark_start.capacity)) 1298 .left(ZSIZE_ARGS(_at_mark_end.capacity)) 1299 .left(ZSIZE_ARGS(_at_relocate_start.capacity)) 1300 .left(ZSIZE_ARGS(_at_relocate_end.capacity)) 1301 .left(ZSIZE_ARGS(_at_relocate_end.capacity_high)) 1302 .left(ZSIZE_ARGS(_at_relocate_end.capacity_low)) |