416 |
416 |
417 // Print out some state information about the current sweep and the |
417 // Print out some state information about the current sweep and the |
418 // state of the code cache if it's requested. |
418 // state of the code cache if it's requested. |
419 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { |
419 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { |
420 if (PrintMethodFlushing) { |
420 if (PrintMethodFlushing) { |
|
421 stringStream s; |
|
422 // Dump code cache state into a buffer before locking the tty, |
|
423 // because log_state() will use locks causing lock conflicts. |
|
424 CodeCache::log_state(&s); |
|
425 |
421 ttyLocker ttyl; |
426 ttyLocker ttyl; |
422 tty->print("### sweeper: %s ", msg); |
427 tty->print("### sweeper: %s ", msg); |
423 if (format != NULL) { |
428 if (format != NULL) { |
424 va_list ap; |
429 va_list ap; |
425 va_start(ap, format); |
430 va_start(ap, format); |
426 tty->vprint(format, ap); |
431 tty->vprint(format, ap); |
427 va_end(ap); |
432 va_end(ap); |
428 } |
433 } |
429 CodeCache::log_state(tty); tty->cr(); |
434 tty->print_cr(s.as_string()); |
430 } |
435 } |
431 |
436 |
432 if (LogCompilation && (xtty != NULL)) { |
437 if (LogCompilation && (xtty != NULL)) { |
|
438 stringStream s; |
|
439 // Dump code cache state into a buffer before locking the tty, |
|
440 // because log_state() will use locks causing lock conflicts. |
|
441 CodeCache::log_state(&s); |
|
442 |
433 ttyLocker ttyl; |
443 ttyLocker ttyl; |
434 xtty->begin_elem("sweeper state='%s' traversals='" INTX_FORMAT "' ", msg, (intx)traversal_count()); |
444 xtty->begin_elem("sweeper state='%s' traversals='" INTX_FORMAT "' ", msg, (intx)traversal_count()); |
435 if (format != NULL) { |
445 if (format != NULL) { |
436 va_list ap; |
446 va_list ap; |
437 va_start(ap, format); |
447 va_start(ap, format); |
438 xtty->vprint(format, ap); |
448 xtty->vprint(format, ap); |
439 va_end(ap); |
449 va_end(ap); |
440 } |
450 } |
441 CodeCache::log_state(xtty); |
451 xtty->print(s.as_string()); |
442 xtty->stamp(); |
452 xtty->stamp(); |
443 xtty->end_elem(); |
453 xtty->end_elem(); |
444 } |
454 } |
445 } |
455 } |