< prev index next >

src/share/vm/runtime/sweeper.cpp

Print this page
rev 8910 : full patch for jfr
   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 379       }
 380       _seen++;
 381       _current = next;
 382     }
 383   }
 384 
 385   assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
 386 
 387   const Ticks sweep_end_counter = Ticks::now();
 388   const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
 389   _total_time_sweeping  += sweep_time;
 390   _total_time_this_sweep += sweep_time;
 391   _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
 392   _total_flushed_size += freed_memory;
 393   _total_nof_methods_reclaimed += _flushed_count;
 394 
 395   EventSweepCodeCache event(UNTIMED);
 396   if (event.should_commit()) {
 397     event.set_starttime(sweep_start_counter);
 398     event.set_endtime(sweep_end_counter);
 399     event.set_sweepIndex(_traversals);
 400     event.set_sweepFractionIndex(NmethodSweepFraction - _sweep_fractions_left + 1);
 401     event.set_sweptCount(swept_count);
 402     event.set_flushedCount(_flushed_count);
 403     event.set_markedCount(_marked_for_reclamation_count);
 404     event.set_zombifiedCount(_zombified_count);
 405     event.commit();
 406   }
 407 
 408 #ifdef ASSERT
 409   if(PrintMethodFlushing) {
 410     tty->print_cr("### sweeper:      sweep time(%d): "
 411       INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
 412   }
 413 #endif
 414 
 415   if (_sweep_fractions_left == 1) {
 416     _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
 417     log_sweep("finished");
 418   }
 419 
 420   // Sweeper is the only case where memory is released, check here if it
 421   // is time to restart the compiler. Only checking if there is a certain
 422   // amount of free memory in the code cache might lead to re-enabling
 423   // compilation although no memory has been released. For example, there are


   1 /*
   2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 379       }
 380       _seen++;
 381       _current = next;
 382     }
 383   }
 384 
 385   assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
 386 
 387   const Ticks sweep_end_counter = Ticks::now();
 388   const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
 389   _total_time_sweeping  += sweep_time;
 390   _total_time_this_sweep += sweep_time;
 391   _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
 392   _total_flushed_size += freed_memory;
 393   _total_nof_methods_reclaimed += _flushed_count;
 394 
 395   EventSweepCodeCache event(UNTIMED);
 396   if (event.should_commit()) {
 397     event.set_starttime(sweep_start_counter);
 398     event.set_endtime(sweep_end_counter);
 399     event.set_sweepId(_traversals);

 400     event.set_sweptCount(swept_count);
 401     event.set_flushedCount(_flushed_count);

 402     event.set_zombifiedCount(_zombified_count);
 403     event.commit();
 404   }
 405 
 406 #ifdef ASSERT
 407   if(PrintMethodFlushing) {
 408     tty->print_cr("### sweeper:      sweep time(%d): "
 409       INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
 410   }
 411 #endif
 412 
 413   if (_sweep_fractions_left == 1) {
 414     _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
 415     log_sweep("finished");
 416   }
 417 
 418   // Sweeper is the only case where memory is released, check here if it
 419   // is time to restart the compiler. Only checking if there is a certain
 420   // amount of free memory in the code cache might lead to re-enabling
 421   // compilation although no memory has been released. For example, there are


< prev index next >