1 #ifdef USE_PRAGMA_IDENT_HDR 2 #pragma ident "@(#)gcCause.hpp 1.24 07/05/05 17:05:40 JVM" 3 #endif 4 /* 5 * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. 6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 * 8 * This code is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License version 2 only, as 10 * published by the Free Software Foundation. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23 * CA 95054 USA or visit www.sun.com if you need additional information or 24 * have any questions. 25 * 26 */ 27 28 // 29 // This class exposes implementation details of the various 30 // collector(s), and we need to be very careful with it. If 31 // use of this class grows, we should split it into public 32 // and implemenation-private "causes". 33 // 34 35 class GCCause : public AllStatic { 36 public: 37 enum Cause { 38 /* public */ 39 _java_lang_system_gc, 40 _full_gc_alot, 41 _scavenge_alot, 42 _allocation_profiler, 43 _jvmti_force_gc, 44 _gc_locker, 45 _heap_inspection, 46 _heap_dump, 47 48 /* implementation independent, but reserved for GC use */ 49 _no_gc, 50 _no_cause_specified, 51 _allocation_failure, 52 53 /* implementation specific */ 54 55 _tenured_generation_full, 56 _permanent_generation_full, 57 58 _cms_generation_full, 59 _cms_initial_mark, 60 _cms_final_remark, 61 62 _old_generation_expanded_on_last_scavenge, 63 _old_generation_too_full_to_scavenge, 64 _adaptive_size_policy, 65 66 _g1_inc_collection_pause, 67 68 _last_ditch_collection, 69 _last_gc_cause 70 }; 71 72 inline static bool is_user_requested_gc(GCCause::Cause cause) { 73 return (cause == GCCause::_java_lang_system_gc || 74 cause == GCCause::_jvmti_force_gc); 75 } 76 77 inline static bool is_serviceability_requested_gc(GCCause::Cause 78 cause) { 79 return (cause == GCCause::_jvmti_force_gc || 80 cause == GCCause::_heap_inspection || 81 cause == GCCause::_heap_dump); 82 } 83 84 // Return a string describing the GCCause. 85 static const char* to_string(GCCause::Cause cause); 86 // Return true if the GCCause is for a full collection. 87 static bool is_for_full_collection(GCCause::Cause cause) PRODUCT_RETURN0; 88 };