mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
perf - fix counting of major GCs (#214016)
This commit is contained in:
parent
aaa5cb462e
commit
3a1ad5f077
|
@ -179,11 +179,9 @@ export class NativeStartupTimings extends StartupTimings implements IWorkbenchCo
|
|||
// Major/Minor GC Events
|
||||
case 'MinorGC':
|
||||
minorGCs++;
|
||||
break;
|
||||
case 'MajorGC':
|
||||
majorGCs++;
|
||||
if (event.args && typeof event.args.usedHeapSizeAfter === 'number' && typeof event.args.usedHeapSizeBefore === 'number') {
|
||||
garbage += (event.args.usedHeapSizeBefore - event.args.usedHeapSizeAfter);
|
||||
}
|
||||
break;
|
||||
|
||||
// GC Events that block the main thread
|
||||
|
@ -193,6 +191,12 @@ export class NativeStartupTimings extends StartupTimings implements IWorkbenchCo
|
|||
duration += event.dur;
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.name === 'MajorGC' || event.name === 'MinorGC') {
|
||||
if (typeof event.args?.usedHeapSizeAfter === 'number' && typeof event.args.usedHeapSizeBefore === 'number') {
|
||||
garbage += (event.args.usedHeapSizeBefore - event.args.usedHeapSizeAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { minorGCs, majorGCs, used, garbage, duration: Math.round(duration / 1000) };
|
||||
|
|
Loading…
Reference in a new issue