src/share/vm/gc_interface/gcCause.hpp

changeset 435
a61af66fc99e
child 777
37f87013dfd8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_interface/gcCause.hpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,81 @@
     1.4 +/*
     1.5 + * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +//
    1.29 +// This class exposes implementation details of the various
    1.30 +// collector(s), and we need to be very careful with it. If
    1.31 +// use of this class grows, we should split it into public
    1.32 +// and implemenation-private "causes".
    1.33 +//
    1.34 +
    1.35 +class GCCause : public AllStatic {
    1.36 + public:
    1.37 +  enum Cause {
    1.38 +    /* public */
    1.39 +    _java_lang_system_gc,
    1.40 +    _full_gc_alot,
    1.41 +    _scavenge_alot,
    1.42 +    _allocation_profiler,
    1.43 +    _jvmti_force_gc,
    1.44 +    _gc_locker,
    1.45 +    _heap_inspection,
    1.46 +    _heap_dump,
    1.47 +
    1.48 +    /* implementation independent, but reserved for GC use */
    1.49 +    _no_gc,
    1.50 +    _no_cause_specified,
    1.51 +    _allocation_failure,
    1.52 +
    1.53 +    /* implementation specific */
    1.54 +
    1.55 +    _tenured_generation_full,
    1.56 +    _permanent_generation_full,
    1.57 +
    1.58 +    _cms_generation_full,
    1.59 +    _cms_initial_mark,
    1.60 +    _cms_final_remark,
    1.61 +
    1.62 +    _old_generation_expanded_on_last_scavenge,
    1.63 +    _old_generation_too_full_to_scavenge,
    1.64 +    _adaptive_size_policy,
    1.65 +
    1.66 +    _last_ditch_collection,
    1.67 +    _last_gc_cause
    1.68 +  };
    1.69 +
    1.70 +  inline static bool is_user_requested_gc(GCCause::Cause cause) {
    1.71 +    return (cause == GCCause::_java_lang_system_gc ||
    1.72 +            cause == GCCause::_jvmti_force_gc);
    1.73 +  }
    1.74 +  inline static bool is_serviceability_requested_gc(GCCause::Cause
    1.75 +                                                             cause) {
    1.76 +    return (cause == GCCause::_jvmti_force_gc ||
    1.77 +            cause == GCCause::_heap_inspection ||
    1.78 +            cause == GCCause::_heap_dump);
    1.79 +  }
    1.80 +  // Return a string describing the GCCause.
    1.81 +  static const char* to_string(GCCause::Cause cause);
    1.82 +  // Return true if the GCCause is for a full collection.
    1.83 +  static bool is_for_full_collection(GCCause::Cause cause) PRODUCT_RETURN0;
    1.84 +};

mercurial