src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp
changeset 52925 9c18c9d839d3
child 53244 9807daeb47c4
equal deleted inserted replaced
52924:420ff459906f 52925:9c18c9d839d3
       
     1 /*
       
     2  * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.
       
     7  *
       
     8  * This code is distributed in the hope that it will be useful, but WITHOUT
       
     9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    11  * version 2 for more details (a copy is included in the LICENSE file that
       
    12  * accompanied this code).
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License version
       
    15  * 2 along with this work; if not, write to the Free Software Foundation,
       
    16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    17  *
       
    18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    19  * or visit www.oracle.com if you need additional information or have any
       
    20  * questions.
       
    21  *
       
    22  */
       
    23 
       
    24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
       
    25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
       
    26 
       
    27 #include "gc/shared/collectorPolicy.hpp"
       
    28 #include "gc/shenandoah/shenandoahHeap.hpp"
       
    29 #include "gc/shenandoah/shenandoahTracer.hpp"
       
    30 #include "utilities/ostream.hpp"
       
    31 
       
    32 class ShenandoahCollectorPolicy: public CollectorPolicy {
       
    33 private:
       
    34   size_t _success_concurrent_gcs;
       
    35   size_t _success_degenerated_gcs;
       
    36   size_t _success_full_gcs;
       
    37   size_t _alloc_failure_degenerated;
       
    38   size_t _alloc_failure_degenerated_upgrade_to_full;
       
    39   size_t _alloc_failure_full;
       
    40   size_t _explicit_concurrent;
       
    41   size_t _explicit_full;
       
    42   size_t _implicit_concurrent;
       
    43   size_t _implicit_full;
       
    44   size_t _degen_points[ShenandoahHeap::_DEGENERATED_LIMIT];
       
    45 
       
    46   ShenandoahSharedFlag _in_shutdown;
       
    47 
       
    48   ShenandoahTracer* _tracer;
       
    49 
       
    50   size_t _cycle_counter;
       
    51 
       
    52 public:
       
    53   ShenandoahCollectorPolicy();
       
    54 
       
    55   void initialize_alignments();
       
    56 
       
    57   // TODO: This is different from gc_end: that one encompasses one VM operation.
       
    58   // These two encompass the entire cycle.
       
    59   void record_cycle_start();
       
    60 
       
    61   void record_success_concurrent();
       
    62   void record_success_degenerated();
       
    63   void record_success_full();
       
    64   void record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point);
       
    65   void record_alloc_failure_to_full();
       
    66   void record_degenerated_upgrade_to_full();
       
    67   void record_explicit_to_concurrent();
       
    68   void record_explicit_to_full();
       
    69   void record_implicit_to_concurrent();
       
    70   void record_implicit_to_full();
       
    71 
       
    72   void record_shutdown();
       
    73   bool is_at_shutdown();
       
    74 
       
    75   ShenandoahTracer* tracer() {return _tracer;}
       
    76 
       
    77   size_t cycle_counter() const;
       
    78 
       
    79   void print_gc_stats(outputStream* out) const;
       
    80 };
       
    81 
       
    82 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP