src/share/vm/runtime/sweeper.cpp

Print this page
rev 4203 : 8008208: Event tracing for code cache subsystems can give wrong timestamps
Reviewed-by:

*** 146,161 **** uint NMethodSweeper::_highest_marked = 0; long NMethodSweeper::_was_full_traversal = 0; int NMethodSweeper::_number_of_flushes = 0; // Total of full traversals caused by full cache int NMethodSweeper::_total_nof_methods_reclaimed = 0; ! long NMethodSweeper::_total_time_sweeping = 0; ! long NMethodSweeper::_total_time_this_sweep = 0; ! long NMethodSweeper::_peak_sweep_time = 0; ! long NMethodSweeper::_peak_sweep_fraction_time = 0; ! long NMethodSweeper::_total_disconnect_time = 0; ! long NMethodSweeper::_peak_disconnect_time = 0; class MarkActivationClosure: public CodeBlobClosure { public: virtual void do_code_blob(CodeBlob* cb) { // If we see an activation belonging to a non_entrant nmethod, we mark it. --- 146,161 ---- uint NMethodSweeper::_highest_marked = 0; long NMethodSweeper::_was_full_traversal = 0; int NMethodSweeper::_number_of_flushes = 0; // Total of full traversals caused by full cache int NMethodSweeper::_total_nof_methods_reclaimed = 0; ! jlong NMethodSweeper::_total_time_sweeping = 0; ! jlong NMethodSweeper::_total_time_this_sweep = 0; ! jlong NMethodSweeper::_peak_sweep_time = 0; ! jlong NMethodSweeper::_peak_sweep_fraction_time = 0; ! jlong NMethodSweeper::_total_disconnect_time = 0; ! jlong NMethodSweeper::_peak_disconnect_time = 0; class MarkActivationClosure: public CodeBlobClosure { public: virtual void do_code_blob(CodeBlob* cb) { // If we see an activation belonging to a non_entrant nmethod, we mark it.
*** 255,267 **** } } void NMethodSweeper::sweep_code_cache() { ! long sweep_start_counter, sweep_end_counter; ! long sweep_time; ! sweep_start_counter = os::elapsed_counter(); _flushed_count = 0; _zombified_count = 0; _marked_count = 0; --- 255,265 ---- } } void NMethodSweeper::sweep_code_cache() { ! jlong sweep_start_counter = os::elapsed_counter(); _flushed_count = 0; _zombified_count = 0; _marked_count = 0;
*** 322,333 **** if (PrintMethodFlushing) { tty->print_cr("### Couldn't make progress on some nmethods so stopping sweep"); } } ! sweep_end_counter = os::elapsed_counter(); ! sweep_time = sweep_end_counter - sweep_start_counter; _total_time_sweeping += sweep_time; _total_time_this_sweep += sweep_time; _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time); _total_nof_methods_reclaimed += _flushed_count; --- 320,331 ---- if (PrintMethodFlushing) { tty->print_cr("### Couldn't make progress on some nmethods so stopping sweep"); } } ! jlong sweep_end_counter = os::elapsed_counter(); ! jlong sweep_time = sweep_end_counter - sweep_start_counter; _total_time_sweeping += sweep_time; _total_time_this_sweep += sweep_time; _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time); _total_nof_methods_reclaimed += _flushed_count;
*** 521,543 **** void NMethodSweeper::speculative_disconnect_nmethods(bool is_full) { // If there was a race in detecting full code cache, only run // one vm op for it or keep the compiler shut off - long disconnect_start_counter; - long disconnect_end_counter; - long disconnect_time; - if ((!was_full()) && (is_full)) { if (!CodeCache::needs_flushing()) { log_sweep("restart_compiler"); CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation); return; } } ! disconnect_start_counter = os::elapsed_counter(); // Traverse the code cache trying to dump the oldest nmethods uint curr_max_comp_id = CompileBroker::get_compilation_id(); uint flush_target = ((curr_max_comp_id - _highest_marked) >> 1) + _highest_marked; log_sweep("start_cleaning"); --- 519,537 ---- void NMethodSweeper::speculative_disconnect_nmethods(bool is_full) { // If there was a race in detecting full code cache, only run // one vm op for it or keep the compiler shut off if ((!was_full()) && (is_full)) { if (!CodeCache::needs_flushing()) { log_sweep("restart_compiler"); CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation); return; } } ! jlong disconnect_start_counter = os::elapsed_counter(); // Traverse the code cache trying to dump the oldest nmethods uint curr_max_comp_id = CompileBroker::get_compilation_id(); uint flush_target = ((curr_max_comp_id - _highest_marked) >> 1) + _highest_marked; log_sweep("start_cleaning");
*** 581,592 **** if (was_full()) { _last_was_full = os::javaTimeMillis(); CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation); } ! disconnect_end_counter = os::elapsed_counter(); ! disconnect_time = disconnect_end_counter - disconnect_start_counter; _total_disconnect_time += disconnect_time; _peak_disconnect_time = MAX2(disconnect_time, _peak_disconnect_time); EventCleanCodeCache event(UNTIMED); if (event.should_commit()) { --- 575,586 ---- if (was_full()) { _last_was_full = os::javaTimeMillis(); CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation); } ! jlong disconnect_end_counter = os::elapsed_counter(); ! jlong disconnect_time = disconnect_end_counter - disconnect_start_counter; _total_disconnect_time += disconnect_time; _peak_disconnect_time = MAX2(disconnect_time, _peak_disconnect_time); EventCleanCodeCache event(UNTIMED); if (event.should_commit()) {