1297 BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters(); |
1297 BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters(); |
1298 if (blc->nonzero()) { |
1298 if (blc->nonzero()) { |
1299 tty->print_cr("%s", c->name()); |
1299 tty->print_cr("%s", c->name()); |
1300 blc->print_on(tty); |
1300 blc->print_on(tty); |
1301 } |
1301 } |
|
1302 #if INCLUDE_RTM_OPT |
|
1303 } else if (c->tag() == NamedCounter::RTMLockingCounter) { |
|
1304 RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters(); |
|
1305 if (rlc->nonzero()) { |
|
1306 tty->print_cr("%s", c->name()); |
|
1307 rlc->print_on(tty); |
|
1308 } |
|
1309 #endif |
1302 } |
1310 } |
1303 c = c->next(); |
1311 c = c->next(); |
1304 } |
1312 } |
1305 if (total_lock_count > 0) { |
1313 if (total_lock_count > 0) { |
1306 tty->print_cr("dynamic locks: %d", total_lock_count); |
1314 tty->print_cr("dynamic locks: %d", total_lock_count); |
1336 // To print linenumbers instead of bci use: m->line_number_from_bci(bci) |
1344 // To print linenumbers instead of bci use: m->line_number_from_bci(bci) |
1337 } |
1345 } |
1338 NamedCounter* c; |
1346 NamedCounter* c; |
1339 if (tag == NamedCounter::BiasedLockingCounter) { |
1347 if (tag == NamedCounter::BiasedLockingCounter) { |
1340 c = new BiasedLockingNamedCounter(strdup(st.as_string())); |
1348 c = new BiasedLockingNamedCounter(strdup(st.as_string())); |
|
1349 } else if (tag == NamedCounter::RTMLockingCounter) { |
|
1350 c = new RTMLockingNamedCounter(strdup(st.as_string())); |
1341 } else { |
1351 } else { |
1342 c = new NamedCounter(strdup(st.as_string()), tag); |
1352 c = new NamedCounter(strdup(st.as_string()), tag); |
1343 } |
1353 } |
1344 |
1354 |
1345 // atomically add the new counter to the head of the list. We only |
1355 // atomically add the new counter to the head of the list. We only |
1346 // add counters so this is safe. |
1356 // add counters so this is safe. |
1347 NamedCounter* head; |
1357 NamedCounter* head; |
1348 do { |
1358 do { |
|
1359 c->set_next(NULL); |
1349 head = _named_counters; |
1360 head = _named_counters; |
1350 c->set_next(head); |
1361 c->set_next(head); |
1351 } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head); |
1362 } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head); |
1352 return c; |
1363 return c; |
1353 } |
1364 } |