MCPcopy Index your code
hub / github.com/callstack/agent-device / readAppleProcessSamples

Function readAppleProcessSamples

src/platforms/apple/core/perf.ts:1041–1060  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  executable: { executableName: string; executablePath?: string },
)

Source from the content-addressed store, hash-verified

1039}
1040
1041export async function readAppleProcessSamples(
1042 device: DeviceInfo,
1043 executable: { executableName: string; executablePath?: string },
1044): Promise<AppleProcessSample[]> {
1045 const args = isMacOs(device)
1046 ? ['-axo', 'pid=,%cpu=,rss=,command=']
1047 : buildSimctlArgsForDevice(device, [
1048 'spawn',
1049 device.id,
1050 'ps',
1051 '-axo',
1052 'pid=,%cpu=,rss=,command=',
1053 ]);
1054 const result = isMacOs(device)
1055 ? await runAppleToolCommand('ps', args, { timeoutMs: APPLE_PERF_TIMEOUT_MS })
1056 : await runAppleSimulatorProcessCommand(args);
1057 return parseApplePsOutput(result.stdout).filter((process) =>
1058 matchesAppleExecutableProcess(process.command, executable),
1059 );
1060}
1061
1062async function resolveAppleMemorySnapshotProcess(
1063 device: DeviceInfo,

Callers 3

sampleApplePerfMetricsFunction · 0.85

Calls 6

isMacOsFunction · 0.90
buildSimctlArgsForDeviceFunction · 0.90
runAppleToolCommandFunction · 0.90
parseApplePsOutputFunction · 0.85

Tested by

no test coverage detected