Sat, 01 Dec 2007 00:00:00 +0000
Initial load
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | # include "incls/_precompiled.incl" |
duke@435 | 26 | # include "incls/_gcCause.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | const char* GCCause::to_string(GCCause::Cause cause) { |
duke@435 | 29 | switch (cause) { |
duke@435 | 30 | case _java_lang_system_gc: |
duke@435 | 31 | return "System.gc()"; |
duke@435 | 32 | |
duke@435 | 33 | case _full_gc_alot: |
duke@435 | 34 | return "FullGCAlot"; |
duke@435 | 35 | |
duke@435 | 36 | case _scavenge_alot: |
duke@435 | 37 | return "ScavengeAlot"; |
duke@435 | 38 | |
duke@435 | 39 | case _allocation_profiler: |
duke@435 | 40 | return "Allocation Profiler"; |
duke@435 | 41 | |
duke@435 | 42 | case _jvmti_force_gc: |
duke@435 | 43 | return "JvmtiEnv ForceGarbageCollection"; |
duke@435 | 44 | |
duke@435 | 45 | case _no_gc: |
duke@435 | 46 | return "No GC"; |
duke@435 | 47 | |
duke@435 | 48 | case _allocation_failure: |
duke@435 | 49 | return "Allocation Failure"; |
duke@435 | 50 | |
duke@435 | 51 | case _gc_locker: |
duke@435 | 52 | return "GCLocker Initiated GC"; |
duke@435 | 53 | |
duke@435 | 54 | case _heap_inspection: |
duke@435 | 55 | return "Heap Inspection Initiated GC"; |
duke@435 | 56 | |
duke@435 | 57 | case _heap_dump: |
duke@435 | 58 | return "Heap Dump Initiated GC"; |
duke@435 | 59 | |
duke@435 | 60 | case _tenured_generation_full: |
duke@435 | 61 | return "Tenured Generation Full"; |
duke@435 | 62 | |
duke@435 | 63 | case _permanent_generation_full: |
duke@435 | 64 | return "Permanent Generation Full"; |
duke@435 | 65 | |
duke@435 | 66 | case _cms_generation_full: |
duke@435 | 67 | return "CMS Generation Full"; |
duke@435 | 68 | |
duke@435 | 69 | case _cms_initial_mark: |
duke@435 | 70 | return "CMS Initial Mark"; |
duke@435 | 71 | |
duke@435 | 72 | case _cms_final_remark: |
duke@435 | 73 | return "CMS Final Remark"; |
duke@435 | 74 | |
duke@435 | 75 | case _old_generation_expanded_on_last_scavenge: |
duke@435 | 76 | return "Old Generation Expanded On Last Scavenge"; |
duke@435 | 77 | |
duke@435 | 78 | case _old_generation_too_full_to_scavenge: |
duke@435 | 79 | return "Old Generation Too Full To Scavenge"; |
duke@435 | 80 | |
duke@435 | 81 | case _last_ditch_collection: |
duke@435 | 82 | return "Last ditch collection"; |
duke@435 | 83 | |
duke@435 | 84 | case _last_gc_cause: |
duke@435 | 85 | return "ILLEGAL VALUE - last gc cause - ILLEGAL VALUE"; |
duke@435 | 86 | |
duke@435 | 87 | default: |
duke@435 | 88 | return "unknown GCCause"; |
duke@435 | 89 | } |
duke@435 | 90 | ShouldNotReachHere(); |
duke@435 | 91 | } |
duke@435 | 92 | |
duke@435 | 93 | #ifndef PRODUCT |
duke@435 | 94 | |
duke@435 | 95 | bool GCCause::is_for_full_collection(GCCause::Cause cause) { |
duke@435 | 96 | bool result; |
duke@435 | 97 | |
duke@435 | 98 | // There are more GCCause::Cause types than listed here. |
duke@435 | 99 | // For brevity, we list only those that cause full collections. |
duke@435 | 100 | switch (cause) { |
duke@435 | 101 | case _allocation_failure: |
duke@435 | 102 | case _tenured_generation_full: |
duke@435 | 103 | case _permanent_generation_full: |
duke@435 | 104 | case _cms_generation_full: |
duke@435 | 105 | case _last_ditch_collection: |
duke@435 | 106 | result = true; |
duke@435 | 107 | break; |
duke@435 | 108 | |
duke@435 | 109 | default: |
duke@435 | 110 | result = false; |
duke@435 | 111 | break; |
duke@435 | 112 | } |
duke@435 | 113 | return result; |
duke@435 | 114 | } |
duke@435 | 115 | |
duke@435 | 116 | #endif // PRODUCT |