src/share/vm/gc_interface/gcCause.cpp

changeset 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_interface/gcCause.cpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,116 @@
     1.4 +/*
     1.5 + * Copyright 2002-2005 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 +# include "incls/_precompiled.incl"
    1.29 +# include "incls/_gcCause.cpp.incl"
    1.30 +
    1.31 +const char* GCCause::to_string(GCCause::Cause cause) {
    1.32 +  switch (cause) {
    1.33 +    case _java_lang_system_gc:
    1.34 +      return "System.gc()";
    1.35 +
    1.36 +    case _full_gc_alot:
    1.37 +      return "FullGCAlot";
    1.38 +
    1.39 +    case _scavenge_alot:
    1.40 +      return "ScavengeAlot";
    1.41 +
    1.42 +    case _allocation_profiler:
    1.43 +      return "Allocation Profiler";
    1.44 +
    1.45 +    case _jvmti_force_gc:
    1.46 +      return "JvmtiEnv ForceGarbageCollection";
    1.47 +
    1.48 +    case _no_gc:
    1.49 +      return "No GC";
    1.50 +
    1.51 +    case _allocation_failure:
    1.52 +      return "Allocation Failure";
    1.53 +
    1.54 +    case _gc_locker:
    1.55 +      return "GCLocker Initiated GC";
    1.56 +
    1.57 +    case _heap_inspection:
    1.58 +      return "Heap Inspection Initiated GC";
    1.59 +
    1.60 +    case _heap_dump:
    1.61 +      return "Heap Dump Initiated GC";
    1.62 +
    1.63 +    case _tenured_generation_full:
    1.64 +      return "Tenured Generation Full";
    1.65 +
    1.66 +    case _permanent_generation_full:
    1.67 +      return "Permanent Generation Full";
    1.68 +
    1.69 +    case _cms_generation_full:
    1.70 +      return "CMS Generation Full";
    1.71 +
    1.72 +    case _cms_initial_mark:
    1.73 +      return "CMS Initial Mark";
    1.74 +
    1.75 +    case _cms_final_remark:
    1.76 +      return "CMS Final Remark";
    1.77 +
    1.78 +    case _old_generation_expanded_on_last_scavenge:
    1.79 +      return "Old Generation Expanded On Last Scavenge";
    1.80 +
    1.81 +    case _old_generation_too_full_to_scavenge:
    1.82 +      return "Old Generation Too Full To Scavenge";
    1.83 +
    1.84 +    case _last_ditch_collection:
    1.85 +      return "Last ditch collection";
    1.86 +
    1.87 +    case _last_gc_cause:
    1.88 +      return "ILLEGAL VALUE - last gc cause - ILLEGAL VALUE";
    1.89 +
    1.90 +    default:
    1.91 +      return "unknown GCCause";
    1.92 +  }
    1.93 +  ShouldNotReachHere();
    1.94 +}
    1.95 +
    1.96 +#ifndef PRODUCT
    1.97 +
    1.98 +bool GCCause::is_for_full_collection(GCCause::Cause cause) {
    1.99 +  bool result;
   1.100 +
   1.101 +  // There are more GCCause::Cause types than listed here.
   1.102 +  // For brevity, we list only those that cause full collections.
   1.103 +  switch (cause) {
   1.104 +    case _allocation_failure:
   1.105 +    case _tenured_generation_full:
   1.106 +    case _permanent_generation_full:
   1.107 +    case _cms_generation_full:
   1.108 +    case _last_ditch_collection:
   1.109 +      result = true;
   1.110 +      break;
   1.111 +
   1.112 +    default:
   1.113 +      result = false;
   1.114 +      break;
   1.115 +  }
   1.116 +  return result;
   1.117 +}
   1.118 +
   1.119 +#endif // PRODUCT

mercurial