perf: diagnoistics improvements
This commit is contained in:
11
electron/diagnostics/high-memory-alert.rules.ts
Normal file
11
electron/diagnostics/high-memory-alert.rules.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/** 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);
|
||||
}
|
||||
Reference in New Issue
Block a user