|
| 1 | +import type { DeviceInfo } from '@agent-device/kernel/device'; |
| 2 | +import type { RuntimeOwnerRef } from './platform-runtime.ts'; |
| 3 | +import type { |
| 4 | + PerfData, |
| 5 | + PerfNativeCaptureRecoveryInput, |
| 6 | + PerfNativeCaptureStartInput, |
| 7 | + PerfNativeCaptureStartResult, |
| 8 | + PerfProfileReportInput, |
| 9 | + PerfRuntimeOperations, |
| 10 | +} from './perf-runtime.ts'; |
| 11 | + |
| 12 | +type NativeCaptureHost = Readonly<{ |
| 13 | + start( |
| 14 | + device: DeviceInfo, |
| 15 | + owner: RuntimeOwnerRef, |
| 16 | + input: PerfNativeCaptureStartInput, |
| 17 | + ): Promise<PerfNativeCaptureStartResult>; |
| 18 | + reattach( |
| 19 | + device: DeviceInfo, |
| 20 | + input: PerfNativeCaptureRecoveryInput, |
| 21 | + ): ReturnType<PerfRuntimeOperations['perfNativeCaptureReattach']>; |
| 22 | + cleanup( |
| 23 | + device: DeviceInfo, |
| 24 | + input: PerfNativeCaptureRecoveryInput, |
| 25 | + ): ReturnType<PerfRuntimeOperations['perfNativeCaptureCleanup']>; |
| 26 | +}>; |
| 27 | + |
| 28 | +export type ApplePerfHost = NativeCaptureHost & |
| 29 | + Readonly<{ |
| 30 | + sampleFrames(device: DeviceInfo, appId: string): Promise<object>; |
| 31 | + frameSampling(device: DeviceInfo): Promise<PerfData>; |
| 32 | + sampleMemory(device: DeviceInfo, appId: string): Promise<object>; |
| 33 | + memorySampling(device: DeviceInfo): Promise<PerfData>; |
| 34 | + memorySnapshotSupport(device: DeviceInfo): Promise<PerfData>; |
| 35 | + captureMemorySnapshot(device: DeviceInfo, appId: string, outputPath: string): Promise<PerfData>; |
| 36 | + writeProfileReport(input: PerfProfileReportInput): Promise<PerfData>; |
| 37 | + }>; |
| 38 | + |
| 39 | +export type AndroidPerfHost = NativeCaptureHost & |
| 40 | + Readonly<{ |
| 41 | + sampleFrames(device: DeviceInfo, appId: string): Promise<object>; |
| 42 | + sampleMemory(device: DeviceInfo, appId: string): Promise<object>; |
| 43 | + captureMemorySnapshot(device: DeviceInfo, appId: string, outputPath: string): Promise<PerfData>; |
| 44 | + writeProfileReport(device: DeviceInfo, input: PerfProfileReportInput): Promise<PerfData>; |
| 45 | + }>; |
| 46 | + |
| 47 | +export type HarmonyPerfHost = Readonly<{ |
| 48 | + sampleMemory(device: DeviceInfo, appId: string): Promise<object>; |
| 49 | +}>; |
| 50 | + |
| 51 | +/** Family-specific native mechanics; platform packages own policy and operation construction. */ |
| 52 | +export type PerfRuntimeHost = Readonly<{ |
| 53 | + apple: ApplePerfHost; |
| 54 | + android: AndroidPerfHost; |
| 55 | + harmony: HarmonyPerfHost; |
| 56 | +}>; |
0 commit comments