mcpField
A
asc-performance

asc-performance

github.com/tddworks测试与质量586 次安装5 周前更新
代码仓库

关于 asc-performance

asc-performance 是用于查看 App Store 应用性能指标和诊断日志的命令行技能。开发者可检查应用或构建级数据,并追踪卡顿、启动缓慢和磁盘写入等反复出现的问题。

主要功能

  1. 01列出应用级和构建级性能指标
  2. 02涵盖启动、卡顿、内存、磁盘和电池数据
  3. 03查找卡顿与启动缓慢的诊断特征
  4. 04深入查看日志和调用栈摘要

适用场景

  1. 01查看应用或构建的性能指标
  2. 02调查卡顿热点及其调用栈
  3. 03比较不同构建的指标

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tddworks/asc-cli-skills --skill asc-performance

安装后在 Claude Code 中输入/asc-performance确认已加载。

附带文件references/commands.md

详细介绍

使用 asc 获取电源与性能信息

下载性能指标和诊断日志,以监控 App 性能指标,包括启动时间、卡顿率、磁盘写入量、内存使用量、电池续航、终止情况和动画卡顿。

身份验证

asc auth login --key-id <id> --issuer-id <id> --private-key-path ~/.asc/AuthKey.p8

导航方式(CAEOAS 操作指引)

每个 JSON 响应都包含一个 "affordances" 字段,其中提供可直接运行的命令,且已填入 ID。按照操作指引,从指标深入查看诊断信息和日志。

App 指标 → 诊断信息 → 日志流程:

// 1. asc perf-metrics list --app-id app-1 → shows performance overview
{
  "id": "app-1-LAUNCH-launchTime",
  "category": "LAUNCH",
  "latestValue": 1.5,
  "affordances": {
    "listAppMetrics": "asc perf-metrics list --app-id app-1"
  }
}

// 2. asc diagnostics list --build-id build-1 → shows hotspots
{
  "id": "sig-1",
  "diagnosticType": "HANGS",
  "weight": 45.2,
  "affordances": {
    "listLogs": "asc diagnostic-logs list --signature-id sig-1",
    "listSignatures": "asc diagnostics list --build-id build-1"
  }
}

// 3. asc diagnostic-logs list --signature-id sig-1 → shows call stacks
{
  "id": "sig-1-0-0",
  "bundleId": "com.example.app",
  "callStackSummary": "main > UIKit > layoutSubviews",
  "affordances": {
    "listLogs": "asc diagnostic-logs list --signature-id sig-1"
  }
}

常见工作流

快速查看 App 性能概况
asc perf-metrics list --app-id 123456789 --pretty
调查特定指标类型
# Launch time only
asc perf-metrics list --app-id 123456789 --metric-type LAUNCH --pretty

# Hang rate only
asc perf-metrics list --app-id 123456789 --metric-type HANG --pretty
对比特定构建版本的指标
asc builds list --app-id 123456789 --output table
asc perf-metrics list --build-id build-abc --pretty
诊断某个构建版本中的卡顿
# 1. List diagnostic signatures (hang hotspots)
asc diagnostics list --build-id build-abc --diagnostic-type HANGS --pretty

# 2. Drill into the top signature's call stacks
asc diagnostic-logs list --signature-id sig-1 --pretty
完整调查流程
# Start from builds
BUILD_ID=$(asc builds list --app-id APP_ID | jq -r '.data[0].id')

# Check performance metrics
asc perf-metrics list --build-id "$BUILD_ID" --pretty

# Find hang hotspots
asc diagnostics list --build-id "$BUILD_ID" --diagnostic-type HANGS --pretty

# Get call stacks for the heaviest signature
SIG_ID=$(asc diagnostics list --build-id "$BUILD_ID" --diagnostic-type HANGS \
  | jq -r '.data | sort_by(-.weight) | .[0].id')
asc diagnostic-logs list --signature-id "$SIG_ID" --pretty

性能指标类别

类别--metric-type 值测量内容
启动LAUNCHApp 启动时间
卡顿HANG主线程卡顿率
内存MEMORY内存峰值和平均使用量
磁盘DISK磁盘写入量
电池BATTERY能耗影响
终止TERMINATION后台/前台终止情况
动画ANIMATION动画卡顿率
存储STORAGE存储空间使用量

诊断类型

类型--diagnostic-type 值捕获内容
卡顿HANGS主线程卡顿特征
磁盘写入DISK_WRITES过量磁盘写入特征
启动LAUNCHES启动缓慢特征

读取结果

PerformanceMetric — 每个指标标识符对应一行(例如 launchTime、peakMemory),数据取自嵌套的 Xcode Metrics API 并扁平化。关键字段:

  • category — 指标所属类别(LAUNCH、HANG 等)
  • latestValue + unit — 最近一次测量值
  • goalValue — Apple 建议的目标值
  • parentType — "app" 或 "build"(表示数据来自 App 级还是构建版本级指标)

DiagnosticSignatureInfo — 按 weight(出现次数的百分比)排序的重复问题模式。权重越高,影响越大。insightDirection 为 "UP" 表示问题正在恶化。

DiagnosticLogEntry — 单条日志,包含设备元数据和 callStackSummary(以 > 连接的前 5 个栈帧)。

完整命令参考

所有标志和示例请参见 commands.md。

评论

支持 Markdown