@electron-memory/monitor 0.2.3 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard-preload.js.map +1 -1
- package/dist/index.d.mts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +283 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +283 -30
- package/dist/index.mjs.map +1 -1
- package/dist/ui/assets/index-DnuSyhKD.js +9 -0
- package/dist/ui/assets/index-DrFTVGFf.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/ui/assets/index-BXj3TlLS.js +0 -9
- package/dist/ui/assets/index-DpEoEDgy.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ipc/preload-api.ts","../src/ipc/channels.ts","../src/core/dashboard-preload.ts"],"sourcesContent":["/**\r\n * Preload API 辅助\r\n * \r\n * 定义暴露给监控面板渲染进程的 API\r\n */\r\n\r\nimport { contextBridge, ipcRenderer } from 'electron'\r\nimport { IPC_CHANNELS } from './channels'\r\n\r\n/** 监控面板 preload 注入的 API 类型 */\r\nexport interface MonitorPanelAPI {\r\n // 会话控制\r\n startSession: (label: string, description?: string) => Promise<string>\r\n stopSession: () => Promise<unknown>\r\n getSessions: () => Promise<
|
|
1
|
+
{"version":3,"sources":["../src/ipc/preload-api.ts","../src/ipc/channels.ts","../src/core/dashboard-preload.ts"],"sourcesContent":["/**\r\n * Preload API 辅助\r\n * \r\n * 定义暴露给监控面板渲染进程的 API\r\n */\r\n\r\nimport { contextBridge, ipcRenderer } from 'electron'\r\nimport { IPC_CHANNELS } from './channels'\r\nimport type { SessionsListPayload, TestSession } from '../types/session'\r\n\r\n/** 监控面板 preload 注入的 API 类型 */\r\nexport interface MonitorPanelAPI {\r\n // 会话控制\r\n startSession: (label: string, description?: string) => Promise<string>\r\n stopSession: () => Promise<unknown>\r\n getSessions: () => Promise<SessionsListPayload | TestSession[]>\r\n getSessionReport: (sessionId: string) => Promise<unknown>\r\n compareSessions: (baseId: string, targetId: string) => Promise<unknown>\r\n\r\n // 数据查询\r\n getSessionSnapshots: (sessionId: string, startTime?: number, endTime?: number, maxPoints?: number) => Promise<unknown[]>\r\n\r\n // 导入导出\r\n exportSession: (sessionId: string) => Promise<{ success: boolean; filePath?: string; error?: string }>\r\n importSession: () => Promise<{ success: boolean; session?: unknown; error?: string }>\r\n deleteSession: (sessionId: string) => Promise<boolean>\r\n\r\n // 工具\r\n triggerGC: () => Promise<unknown>\r\n takeHeapSnapshot: (filePath?: string) => Promise<string>\r\n addMark: (label: string, metadata?: Record<string, unknown>) => Promise<void>\r\n getConfig: () => Promise<unknown>\r\n\r\n // 数据订阅\r\n onSnapshot: (callback: (data: unknown) => void) => void\r\n onAnomaly: (callback: (data: unknown) => void) => void\r\n\r\n // 移除监听器\r\n removeSnapshotListener: () => void\r\n removeAnomalyListener: () => void\r\n}\r\n\r\n/** 在监控面板的 preload 中注入 API */\r\nexport function injectMonitorPanelAPI(): void {\r\n const api: MonitorPanelAPI = {\r\n // 会话控制\r\n startSession: (label: string, description?: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_START, { label, description }),\r\n stopSession: () =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_STOP),\r\n getSessions: () =>\r\n ipcRenderer.invoke(IPC_CHANNELS.GET_SESSIONS),\r\n getSessionReport: (sessionId: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_REPORT, sessionId),\r\n compareSessions: (baseId: string, targetId: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_COMPARE, { baseId, targetId }),\r\n\r\n // 数据查询\r\n getSessionSnapshots: (sessionId: string, startTime?: number, endTime?: number, maxPoints?: number) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_SNAPSHOTS, { sessionId, startTime, endTime, maxPoints }),\r\n\r\n // 导入导出\r\n exportSession: (sessionId: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_EXPORT, sessionId),\r\n importSession: () =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_IMPORT),\r\n deleteSession: (sessionId: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.SESSION_DELETE, sessionId),\r\n\r\n // 工具\r\n triggerGC: () =>\r\n ipcRenderer.invoke(IPC_CHANNELS.TRIGGER_GC),\r\n takeHeapSnapshot: (filePath?: string) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.HEAP_SNAPSHOT, filePath),\r\n addMark: (label: string, metadata?: Record<string, unknown>) =>\r\n ipcRenderer.invoke(IPC_CHANNELS.MARK, { label, metadata }),\r\n getConfig: () =>\r\n ipcRenderer.invoke(IPC_CHANNELS.GET_CONFIG),\r\n\r\n // 数据订阅\r\n onSnapshot: (callback: (data: unknown) => void) => {\r\n ipcRenderer.on(IPC_CHANNELS.SNAPSHOT, (_event, data) => callback(data))\r\n },\r\n onAnomaly: (callback: (data: unknown) => void) => {\r\n ipcRenderer.on(IPC_CHANNELS.ANOMALY, (_event, data) => callback(data))\r\n },\r\n\r\n // 移除监听器\r\n removeSnapshotListener: () => {\r\n ipcRenderer.removeAllListeners(IPC_CHANNELS.SNAPSHOT)\r\n },\r\n removeAnomalyListener: () => {\r\n ipcRenderer.removeAllListeners(IPC_CHANNELS.ANOMALY)\r\n },\r\n }\r\n\r\n contextBridge.exposeInMainWorld('monitorAPI', api)\r\n}\r\n","/**\r\n * IPC 通道常量定义\r\n * 所有通道以 'emm:' 为前缀,避免与业务 IPC 冲突\r\n */\r\n\r\nexport const IPC_CHANNELS = {\r\n // === 数据推送(主进程 → 监控面板)===\r\n SNAPSHOT: 'emm:snapshot',\r\n ANOMALY: 'emm:anomaly',\r\n\r\n // === 会话控制(面板 → 主进程)===\r\n SESSION_START: 'emm:session:start',\r\n SESSION_STOP: 'emm:session:stop',\r\n SESSION_LIST: 'emm:session:list',\r\n SESSION_REPORT: 'emm:session:report',\r\n SESSION_COMPARE: 'emm:session:compare',\r\n\r\n // === 数据查询(面板 → 主进程)===\r\n SESSION_SNAPSHOTS: 'emm:session:snapshots',\r\n\r\n // === 工具操作(面板 → 主进程)===\r\n TRIGGER_GC: 'emm:gc',\r\n HEAP_SNAPSHOT: 'emm:heap-snapshot',\r\n MARK: 'emm:mark',\r\n CONFIG_UPDATE: 'emm:config:update',\r\n GET_CONFIG: 'emm:config:get',\r\n GET_SESSIONS: 'emm:sessions:get',\r\n\r\n // === 导入导出(面板 → 主进程)===\r\n SESSION_EXPORT: 'emm:session:export',\r\n SESSION_IMPORT: 'emm:session:import',\r\n SESSION_DELETE: 'emm:session:delete',\r\n\r\n // === 渲染进程上报(可选)===\r\n RENDERER_REPORT: 'emm:renderer:report',\r\n RENDERER_REQUEST: 'emm:renderer:request',\r\n} as const\r\n","/**\r\n * Dashboard Preload 脚本\r\n * 在监控面板 BrowserWindow 中使用\r\n */\r\n\r\nimport { injectMonitorPanelAPI } from '../ipc/preload-api'\r\n\r\ninjectMonitorPanelAPI()\r\n"],"mappings":";;;AAMA,sBAA2C;;;ACDpC,IAAM,eAAe;AAAA;AAAA,EAE1B,UAAU;AAAA,EACV,SAAS;AAAA;AAAA,EAGT,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA;AAAA,EAGjB,mBAAmB;AAAA;AAAA,EAGnB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,MAAM;AAAA,EACN,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,cAAc;AAAA;AAAA,EAGd,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;;;ADOO,SAAS,wBAA8B;AAC5C,QAAM,MAAuB;AAAA;AAAA,IAE3B,cAAc,CAAC,OAAe,gBAC5B,4BAAY,OAAO,aAAa,eAAe,EAAE,OAAO,YAAY,CAAC;AAAA,IACvE,aAAa,MACX,4BAAY,OAAO,aAAa,YAAY;AAAA,IAC9C,aAAa,MACX,4BAAY,OAAO,aAAa,YAAY;AAAA,IAC9C,kBAAkB,CAAC,cACjB,4BAAY,OAAO,aAAa,gBAAgB,SAAS;AAAA,IAC3D,iBAAiB,CAAC,QAAgB,aAChC,4BAAY,OAAO,aAAa,iBAAiB,EAAE,QAAQ,SAAS,CAAC;AAAA;AAAA,IAGvE,qBAAqB,CAAC,WAAmB,WAAoB,SAAkB,cAC7E,4BAAY,OAAO,aAAa,mBAAmB,EAAE,WAAW,WAAW,SAAS,UAAU,CAAC;AAAA;AAAA,IAGjG,eAAe,CAAC,cACd,4BAAY,OAAO,aAAa,gBAAgB,SAAS;AAAA,IAC3D,eAAe,MACb,4BAAY,OAAO,aAAa,cAAc;AAAA,IAChD,eAAe,CAAC,cACd,4BAAY,OAAO,aAAa,gBAAgB,SAAS;AAAA;AAAA,IAG3D,WAAW,MACT,4BAAY,OAAO,aAAa,UAAU;AAAA,IAC5C,kBAAkB,CAAC,aACjB,4BAAY,OAAO,aAAa,eAAe,QAAQ;AAAA,IACzD,SAAS,CAAC,OAAe,aACvB,4BAAY,OAAO,aAAa,MAAM,EAAE,OAAO,SAAS,CAAC;AAAA,IAC3D,WAAW,MACT,4BAAY,OAAO,aAAa,UAAU;AAAA;AAAA,IAG5C,YAAY,CAAC,aAAsC;AACjD,kCAAY,GAAG,aAAa,UAAU,CAAC,QAAQ,SAAS,SAAS,IAAI,CAAC;AAAA,IACxE;AAAA,IACA,WAAW,CAAC,aAAsC;AAChD,kCAAY,GAAG,aAAa,SAAS,CAAC,QAAQ,SAAS,SAAS,IAAI,CAAC;AAAA,IACvE;AAAA;AAAA,IAGA,wBAAwB,MAAM;AAC5B,kCAAY,mBAAmB,aAAa,QAAQ;AAAA,IACtD;AAAA,IACA,uBAAuB,MAAM;AAC3B,kCAAY,mBAAmB,aAAa,OAAO;AAAA,IACrD;AAAA,EACF;AAEA,gCAAc,kBAAkB,cAAc,GAAG;AACnD;;;AE1FA,sBAAsB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -151,6 +151,19 @@ interface AnomalyEvent {
|
|
|
151
151
|
value?: number;
|
|
152
152
|
/** 阈值 */
|
|
153
153
|
threshold?: number;
|
|
154
|
+
/** 排查建议列表 */
|
|
155
|
+
suggestions?: string[];
|
|
156
|
+
/** 可执行的快捷操作 */
|
|
157
|
+
actions?: AnomalyAction[];
|
|
158
|
+
}
|
|
159
|
+
/** 告警可附带的快捷操作 */
|
|
160
|
+
interface AnomalyAction {
|
|
161
|
+
/** 操作 ID */
|
|
162
|
+
id: string;
|
|
163
|
+
/** 按钮文案 */
|
|
164
|
+
label: string;
|
|
165
|
+
/** 操作类型 */
|
|
166
|
+
type: 'heap-snapshot' | 'trigger-gc' | 'open-devtools';
|
|
154
167
|
}
|
|
155
168
|
/** 异常检测规则 */
|
|
156
169
|
interface AnomalyRule {
|
|
@@ -175,6 +188,17 @@ interface MonitorConfig {
|
|
|
175
188
|
autoStart: boolean;
|
|
176
189
|
/** 启动后是否自动打开监控面板,默认 true */
|
|
177
190
|
openDashboardOnStart: boolean;
|
|
191
|
+
session: {
|
|
192
|
+
/**
|
|
193
|
+
* 监控启动后自动创建一条「进行中」会话并开始写入快照,无需在看板点「开始会话」。
|
|
194
|
+
* 每次进程启动一条新会话,标签带本地时间。默认 true。
|
|
195
|
+
*/
|
|
196
|
+
autoStartOnLaunch: boolean;
|
|
197
|
+
/** 自动会话标签前缀,完整标签为 `${prefix} YYYY-MM-DD HH:mm:ss` */
|
|
198
|
+
autoLabelPrefix: string;
|
|
199
|
+
/** 自动会话描述,可选 */
|
|
200
|
+
autoDescription?: string;
|
|
201
|
+
};
|
|
178
202
|
/** 采集间隔 (ms),默认 2000 */
|
|
179
203
|
collectInterval: number;
|
|
180
204
|
/** 落盘间隔 (条数),默认 60 */
|
|
@@ -243,6 +267,11 @@ interface SessionIndex {
|
|
|
243
267
|
sessions: TestSession[];
|
|
244
268
|
lastUpdated: number;
|
|
245
269
|
}
|
|
270
|
+
/** IPC 拉取会话列表时附带「当前是否在录」:以主进程内存为准,避免索引里僵尸 running */
|
|
271
|
+
interface SessionsListPayload {
|
|
272
|
+
sessions: TestSession[];
|
|
273
|
+
activeSessionId: string | null;
|
|
274
|
+
}
|
|
246
275
|
|
|
247
276
|
/**
|
|
248
277
|
* 报告与对比相关类型
|
|
@@ -277,6 +306,17 @@ interface TrendInfo {
|
|
|
277
306
|
/** 置信度 */
|
|
278
307
|
confidence: 'high' | 'medium' | 'low';
|
|
279
308
|
}
|
|
309
|
+
/** 会话中的阶段标记(写入报告,便于对照各阶段内存) */
|
|
310
|
+
interface SessionEventMark {
|
|
311
|
+
timestamp: number;
|
|
312
|
+
label: string;
|
|
313
|
+
metadata?: Record<string, unknown>;
|
|
314
|
+
/** 该标记随附快照时刻的总工作集 (KB) */
|
|
315
|
+
totalWorkingSetKB: number;
|
|
316
|
+
browserKB: number;
|
|
317
|
+
rendererKB: number;
|
|
318
|
+
gpuKB: number;
|
|
319
|
+
}
|
|
280
320
|
/** 改进建议 */
|
|
281
321
|
interface Suggestion {
|
|
282
322
|
/** 建议 ID */
|
|
@@ -339,6 +379,8 @@ interface SessionReport {
|
|
|
339
379
|
};
|
|
340
380
|
anomalies: AnomalyEvent[];
|
|
341
381
|
suggestions: Suggestion[];
|
|
382
|
+
/** 阶段标记汇总(与快照中的 marks 一致,便于表格展示) */
|
|
383
|
+
eventMarks?: SessionEventMark[];
|
|
342
384
|
dataFile: string;
|
|
343
385
|
}
|
|
344
386
|
/** 指标差异 */
|
|
@@ -438,6 +480,8 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
438
480
|
startSession(label: string, description?: string): string;
|
|
439
481
|
/** 结束当前会话 */
|
|
440
482
|
stopSession(): Promise<SessionReport | null>;
|
|
483
|
+
/** 为已落盘元数据的会话生成并写入 report.json(显式结束或被新会话顶替) */
|
|
484
|
+
private persistCompletedSessionReport;
|
|
441
485
|
/** 打开监控面板 */
|
|
442
486
|
openDashboard(): void;
|
|
443
487
|
/** 关闭监控面板 */
|
|
@@ -446,6 +490,10 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
446
490
|
getCurrentSnapshot(): MemorySnapshot | null;
|
|
447
491
|
/** 获取历史会话列表 */
|
|
448
492
|
getSessions(): Promise<TestSession[]>;
|
|
493
|
+
/**
|
|
494
|
+
* 供监控面板 IPC:列表来自磁盘索引,是否在录制以内存中的 currentSession 为准(避免索引僵尸 running)
|
|
495
|
+
*/
|
|
496
|
+
getSessionsPayloadForIpc(): SessionsListPayload;
|
|
449
497
|
/** 获取指定会话报告 */
|
|
450
498
|
getSessionReport(sessionId: string): Promise<SessionReport | null>;
|
|
451
499
|
/** 获取指定会话的快照数据(支持时间过滤和降采样) */
|
|
@@ -478,6 +526,7 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
478
526
|
getConfig(): MonitorConfig;
|
|
479
527
|
on(event: 'snapshot', handler: (data: MemorySnapshot) => void): this;
|
|
480
528
|
on(event: 'anomaly', handler: (event: AnomalyEvent) => void): this;
|
|
529
|
+
on(event: 'session-start', handler: (session: TestSession) => void): this;
|
|
481
530
|
on(event: 'session-end', handler: (report: SessionReport) => void): this;
|
|
482
531
|
private onSnapshot;
|
|
483
532
|
private mergeConfig;
|
|
@@ -515,4 +564,4 @@ declare const IPC_CHANNELS: {
|
|
|
515
564
|
readonly RENDERER_REQUEST: "emm:renderer:request";
|
|
516
565
|
};
|
|
517
566
|
|
|
518
|
-
export { type AnomalyCategory, type AnomalyEvent, type AnomalyRule, type AnomalySeverity, type CompareReport, ElectronMemoryMonitor, type EventMark, type GCResult, IPC_CHANNELS, type Improvement, type MemorySnapshot, type MetricDiff, type MetricSummary, type MonitorConfig, type ProcessMemoryInfo, type Regression, type RendererV8Detail, type SessionIndex, type SessionReport, type Suggestion, type SystemMemoryInfo, type TestSession, type TrendInfo, type V8HeapDetailStats, type V8HeapSpaceInfo, type V8HeapStats, registerDashboardSchemePrivileged };
|
|
567
|
+
export { type AnomalyCategory, type AnomalyEvent, type AnomalyRule, type AnomalySeverity, type CompareReport, ElectronMemoryMonitor, type EventMark, type GCResult, IPC_CHANNELS, type Improvement, type MemorySnapshot, type MetricDiff, type MetricSummary, type MonitorConfig, type ProcessMemoryInfo, type Regression, type RendererV8Detail, type SessionEventMark, type SessionIndex, type SessionReport, type SessionsListPayload, type Suggestion, type SystemMemoryInfo, type TestSession, type TrendInfo, type V8HeapDetailStats, type V8HeapSpaceInfo, type V8HeapStats, registerDashboardSchemePrivileged };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,19 @@ interface AnomalyEvent {
|
|
|
151
151
|
value?: number;
|
|
152
152
|
/** 阈值 */
|
|
153
153
|
threshold?: number;
|
|
154
|
+
/** 排查建议列表 */
|
|
155
|
+
suggestions?: string[];
|
|
156
|
+
/** 可执行的快捷操作 */
|
|
157
|
+
actions?: AnomalyAction[];
|
|
158
|
+
}
|
|
159
|
+
/** 告警可附带的快捷操作 */
|
|
160
|
+
interface AnomalyAction {
|
|
161
|
+
/** 操作 ID */
|
|
162
|
+
id: string;
|
|
163
|
+
/** 按钮文案 */
|
|
164
|
+
label: string;
|
|
165
|
+
/** 操作类型 */
|
|
166
|
+
type: 'heap-snapshot' | 'trigger-gc' | 'open-devtools';
|
|
154
167
|
}
|
|
155
168
|
/** 异常检测规则 */
|
|
156
169
|
interface AnomalyRule {
|
|
@@ -175,6 +188,17 @@ interface MonitorConfig {
|
|
|
175
188
|
autoStart: boolean;
|
|
176
189
|
/** 启动后是否自动打开监控面板,默认 true */
|
|
177
190
|
openDashboardOnStart: boolean;
|
|
191
|
+
session: {
|
|
192
|
+
/**
|
|
193
|
+
* 监控启动后自动创建一条「进行中」会话并开始写入快照,无需在看板点「开始会话」。
|
|
194
|
+
* 每次进程启动一条新会话,标签带本地时间。默认 true。
|
|
195
|
+
*/
|
|
196
|
+
autoStartOnLaunch: boolean;
|
|
197
|
+
/** 自动会话标签前缀,完整标签为 `${prefix} YYYY-MM-DD HH:mm:ss` */
|
|
198
|
+
autoLabelPrefix: string;
|
|
199
|
+
/** 自动会话描述,可选 */
|
|
200
|
+
autoDescription?: string;
|
|
201
|
+
};
|
|
178
202
|
/** 采集间隔 (ms),默认 2000 */
|
|
179
203
|
collectInterval: number;
|
|
180
204
|
/** 落盘间隔 (条数),默认 60 */
|
|
@@ -243,6 +267,11 @@ interface SessionIndex {
|
|
|
243
267
|
sessions: TestSession[];
|
|
244
268
|
lastUpdated: number;
|
|
245
269
|
}
|
|
270
|
+
/** IPC 拉取会话列表时附带「当前是否在录」:以主进程内存为准,避免索引里僵尸 running */
|
|
271
|
+
interface SessionsListPayload {
|
|
272
|
+
sessions: TestSession[];
|
|
273
|
+
activeSessionId: string | null;
|
|
274
|
+
}
|
|
246
275
|
|
|
247
276
|
/**
|
|
248
277
|
* 报告与对比相关类型
|
|
@@ -277,6 +306,17 @@ interface TrendInfo {
|
|
|
277
306
|
/** 置信度 */
|
|
278
307
|
confidence: 'high' | 'medium' | 'low';
|
|
279
308
|
}
|
|
309
|
+
/** 会话中的阶段标记(写入报告,便于对照各阶段内存) */
|
|
310
|
+
interface SessionEventMark {
|
|
311
|
+
timestamp: number;
|
|
312
|
+
label: string;
|
|
313
|
+
metadata?: Record<string, unknown>;
|
|
314
|
+
/** 该标记随附快照时刻的总工作集 (KB) */
|
|
315
|
+
totalWorkingSetKB: number;
|
|
316
|
+
browserKB: number;
|
|
317
|
+
rendererKB: number;
|
|
318
|
+
gpuKB: number;
|
|
319
|
+
}
|
|
280
320
|
/** 改进建议 */
|
|
281
321
|
interface Suggestion {
|
|
282
322
|
/** 建议 ID */
|
|
@@ -339,6 +379,8 @@ interface SessionReport {
|
|
|
339
379
|
};
|
|
340
380
|
anomalies: AnomalyEvent[];
|
|
341
381
|
suggestions: Suggestion[];
|
|
382
|
+
/** 阶段标记汇总(与快照中的 marks 一致,便于表格展示) */
|
|
383
|
+
eventMarks?: SessionEventMark[];
|
|
342
384
|
dataFile: string;
|
|
343
385
|
}
|
|
344
386
|
/** 指标差异 */
|
|
@@ -438,6 +480,8 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
438
480
|
startSession(label: string, description?: string): string;
|
|
439
481
|
/** 结束当前会话 */
|
|
440
482
|
stopSession(): Promise<SessionReport | null>;
|
|
483
|
+
/** 为已落盘元数据的会话生成并写入 report.json(显式结束或被新会话顶替) */
|
|
484
|
+
private persistCompletedSessionReport;
|
|
441
485
|
/** 打开监控面板 */
|
|
442
486
|
openDashboard(): void;
|
|
443
487
|
/** 关闭监控面板 */
|
|
@@ -446,6 +490,10 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
446
490
|
getCurrentSnapshot(): MemorySnapshot | null;
|
|
447
491
|
/** 获取历史会话列表 */
|
|
448
492
|
getSessions(): Promise<TestSession[]>;
|
|
493
|
+
/**
|
|
494
|
+
* 供监控面板 IPC:列表来自磁盘索引,是否在录制以内存中的 currentSession 为准(避免索引僵尸 running)
|
|
495
|
+
*/
|
|
496
|
+
getSessionsPayloadForIpc(): SessionsListPayload;
|
|
449
497
|
/** 获取指定会话报告 */
|
|
450
498
|
getSessionReport(sessionId: string): Promise<SessionReport | null>;
|
|
451
499
|
/** 获取指定会话的快照数据(支持时间过滤和降采样) */
|
|
@@ -478,6 +526,7 @@ declare class ElectronMemoryMonitor extends EventEmitter {
|
|
|
478
526
|
getConfig(): MonitorConfig;
|
|
479
527
|
on(event: 'snapshot', handler: (data: MemorySnapshot) => void): this;
|
|
480
528
|
on(event: 'anomaly', handler: (event: AnomalyEvent) => void): this;
|
|
529
|
+
on(event: 'session-start', handler: (session: TestSession) => void): this;
|
|
481
530
|
on(event: 'session-end', handler: (report: SessionReport) => void): this;
|
|
482
531
|
private onSnapshot;
|
|
483
532
|
private mergeConfig;
|
|
@@ -515,4 +564,4 @@ declare const IPC_CHANNELS: {
|
|
|
515
564
|
readonly RENDERER_REQUEST: "emm:renderer:request";
|
|
516
565
|
};
|
|
517
566
|
|
|
518
|
-
export { type AnomalyCategory, type AnomalyEvent, type AnomalyRule, type AnomalySeverity, type CompareReport, ElectronMemoryMonitor, type EventMark, type GCResult, IPC_CHANNELS, type Improvement, type MemorySnapshot, type MetricDiff, type MetricSummary, type MonitorConfig, type ProcessMemoryInfo, type Regression, type RendererV8Detail, type SessionIndex, type SessionReport, type Suggestion, type SystemMemoryInfo, type TestSession, type TrendInfo, type V8HeapDetailStats, type V8HeapSpaceInfo, type V8HeapStats, registerDashboardSchemePrivileged };
|
|
567
|
+
export { type AnomalyCategory, type AnomalyEvent, type AnomalyRule, type AnomalySeverity, type CompareReport, ElectronMemoryMonitor, type EventMark, type GCResult, IPC_CHANNELS, type Improvement, type MemorySnapshot, type MetricDiff, type MetricSummary, type MonitorConfig, type ProcessMemoryInfo, type Regression, type RendererV8Detail, type SessionEventMark, type SessionIndex, type SessionReport, type SessionsListPayload, type Suggestion, type SystemMemoryInfo, type TestSession, type TrendInfo, type V8HeapDetailStats, type V8HeapSpaceInfo, type V8HeapStats, registerDashboardSchemePrivileged };
|