12 lines
464 B
TypeScript
12 lines
464 B
TypeScript
/** 2 GiB working-set threshold for writing a diagnostics snapshot. */
|
|
export const HIGH_MEMORY_THRESHOLD_KB = 2 * 1024 * 1024;
|
|
|
|
export function exceedsHighMemoryThreshold(totalWorkingSetKb: number | null | undefined): boolean {
|
|
return typeof totalWorkingSetKb === 'number'
|
|
&& totalWorkingSetKb >= HIGH_MEMORY_THRESHOLD_KB;
|
|
}
|
|
|
|
export function formatWorkingSetGb(totalWorkingSetKb: number): string {
|
|
return (totalWorkingSetKb / (1024 * 1024)).toFixed(2);
|
|
}
|