perf: Add ram metric
This commit is contained in:
23
electron/app-metrics.ts
Normal file
23
electron/app-metrics.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { app } from 'electron';
|
||||
|
||||
export interface AppMetricsProcessSnapshot {
|
||||
pid: number;
|
||||
type: string;
|
||||
workingSetKb: number | null;
|
||||
}
|
||||
|
||||
export interface AppMetricsSnapshot {
|
||||
collectedAt: number;
|
||||
processes: AppMetricsProcessSnapshot[];
|
||||
}
|
||||
|
||||
export function collectAppMetricsSnapshot(): AppMetricsSnapshot {
|
||||
return {
|
||||
collectedAt: Date.now(),
|
||||
processes: app.getAppMetrics().map((metric) => ({
|
||||
pid: metric.pid,
|
||||
type: metric.type,
|
||||
workingSetKb: metric.memory?.workingSetSize ?? null
|
||||
}))
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user