export function getCauseHint()

in frontend/src/components/gclog/utils.ts [42:123]


export function getCauseHint(cause: string) {
  switch (cause) {
    case 'Full GC for -Xshare:dump':
      return 'cause.archiveShare';
    case 'CMS Final Remark':
      return 'cause.cmsFinalRemark';
    case 'System.gc()':
      return 'cause.systemgc';
    case 'JvmtiEnv ForceGarbageCollection':
      return 'cause.jvmti';
    case 'GCLocker Initiated GC':
      return 'cause.gclocker';
    case 'Heap Inspection Initiated GC':
      return 'cause.heapInspection';
    case 'Heap Dump Initiated GC':
      return 'cause.heapDump';
    case 'Allocation Failure':
      return 'cause.allocationFail';
    case 'Metadata GC Threshold':
      return 'cause.metaspace';
    case 'Ergonomics':
      return 'cause.ergonomics';
    case 'G1 Evacuation Pause':
      return 'cause.g1Evacuation';
    case 'G1 Humongous Allocation':
      return ['cause.humongous', 'generation.humongousHint'];
    case 'Last ditch collection':
      return 'cause.lastDitch';
    case 'Promotion Failed':
      return 'cause.promotionFail';
    case 'To-space Exhausted':
      return 'cause.toSpaceExhausted';
    case 'Proactive':
      return 'cause.proactive';
    case 'Allocation Rate':
      return 'cause.allocationRate';
    case 'Timer':
      return 'cause.timer';
    case 'Allocation Stall':
      return 'cause.allocationStall';
    case 'High Usage':
      return 'cause.highUsage';
    case 'Warmup':
      return 'cause.warmup';
    case 'Metadata GC Clear Soft References':
      return 'cause.metaspaceClearSoftRef';
    case 'G1 Periodic Collection':
      return 'cause.g1Periodic';
    case 'Diagnostic Command':
      return 'cause.dcmd';
    case 'G1 Compaction Pause':
      return 'cause.g1Compaction';
    case 'G1 Preventive Collection':
      return 'cause.g1Preventive';

    // other causes are not supported by jifa for the time being, or used for debugging or testing gc,
    // or never printed in gc log

    // case "Allocation Failure During Evacuation":
    // case "Stopping VM":
    // case "Concurrent GC":
    // case "Upgrade To Full GC":
    // case "FullGCAlot":
    // case "ScavengeAlot":
    // case "Allocation Profiler":
    // case "WhiteBox Initiated Young GC":
    // case "WhiteBox Initiated Concurrent Mark":
    // case "Update Allocation Context Stats":
    // case "No GC":
    // case "Tenured Generation Full":
    // case "CMS Generation Full":
    // case "CMS Initial Mark":
    // case "CMS Concurrent Mark":
    // case "Old Generation Expanded On Last Scavenge":
    // case "Old Generation Too Full To Scavenge":
    // case "ILLEGAL VALUE - last gc cause - ILLEGAL VALUE":
    // case "WhiteBox Initiated Full GC":
    // case "unknown GCCause":
    default:
      return '';
  }
}