asc-performance

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Power & Performance with
asc

借助
asc
管理功耗与性能

Download performance metrics and diagnostic logs to monitor app performance indicators — launch time, hang rate, disk writes, memory use, battery life, termination, and animation hitches.
下载性能指标与诊断日志,监控应用性能指标——启动时间、卡顿率、磁盘写入、内存占用、电池寿命、进程终止以及动画卡顿情况。

Authentication

身份验证

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

How to Navigate (CAEOAS Affordances)

操作导航(CAEOAS 功能入口)

Every JSON response contains an
"affordances"
field with ready-to-run commands — IDs already filled in. Follow the affordances to drill down from metrics to diagnostics to logs.
App metrics → Diagnostics → Logs flow:
json
// 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"
  }
}
每个JSON响应都包含一个
"affordances"
字段,其中填充了可直接运行的命令(已自动填入ID)。按照该字段的指引,可从指标逐步深入到诊断信息,再到日志。
应用指标 → 诊断信息 → 日志流程:
json
// 1. asc perf-metrics list --app-id app-1 → 显示性能概览
{
  "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 → 显示问题热点
{
  "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 → 显示调用栈
{
  "id": "sig-1-0-0",
  "bundleId": "com.example.app",
  "callStackSummary": "main > UIKit > layoutSubviews",
  "affordances": {
    "listLogs": "asc diagnostic-logs list --signature-id sig-1"
  }
}

Typical Workflows

典型工作流

Check app performance at a glance

快速查看应用性能

bash
asc perf-metrics list --app-id 123456789 --pretty
bash
asc perf-metrics list --app-id 123456789 --pretty

Investigate a specific metric type

排查特定类型的指标

bash
undefined
bash
undefined

Launch time only

仅查看启动时间

asc perf-metrics list --app-id 123456789 --metric-type LAUNCH --pretty
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
undefined
asc perf-metrics list --app-id 123456789 --metric-type HANG --pretty
undefined

Compare build-specific metrics

对比不同构建版本的指标

bash
asc builds list --app-id 123456789 --output table
asc perf-metrics list --build-id build-abc --pretty
bash
asc builds list --app-id 123456789 --output table
asc perf-metrics list --build-id build-abc --pretty

Diagnose hangs in a build

诊断构建版本中的卡顿问题

bash
undefined
bash
undefined

1. List diagnostic signatures (hang hotspots)

1. 列出诊断特征(卡顿热点)

asc diagnostics list --build-id build-abc --diagnostic-type HANGS --pretty
asc diagnostics list --build-id build-abc --diagnostic-type HANGS --pretty

2. Drill into the top signature's call stacks

2. 深入查看排名靠前的特征对应的调用栈

asc diagnostic-logs list --signature-id sig-1 --pretty
undefined
asc diagnostic-logs list --signature-id sig-1 --pretty
undefined

Full investigation pipeline

完整排查流程

bash
undefined
bash
undefined

Start from builds

从构建版本开始

BUILD_ID=$(asc builds list --app-id APP_ID | jq -r '.data[0].id')
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
asc perf-metrics list --build-id "$BUILD_ID" --pretty

Find hang hotspots

查找卡顿热点

asc diagnostics list --build-id "$BUILD_ID" --diagnostic-type HANGS --pretty
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
undefined
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
undefined

Performance Metric Categories

性能指标分类

Category
--metric-type
value
What it measures
Launch
LAUNCH
App launch time
Hang
HANG
Main thread hang rate
Memory
MEMORY
Peak and average memory use
Disk
DISK
Disk write volume
Battery
BATTERY
Energy impact
Termination
TERMINATION
Background/foreground terminations
Animation
ANIMATION
Animation hitch rate
分类
--metric-type
参数值
衡量内容
启动
LAUNCH
应用启动时间
卡顿
HANG
主线程卡顿率
内存
MEMORY
峰值与平均内存占用
磁盘
DISK
磁盘写入量
电池
BATTERY
能耗影响
进程终止
TERMINATION
后台/前台进程终止情况
动画
ANIMATION
动画卡顿率

Diagnostic Types

诊断类型

Type
--diagnostic-type
value
What it captures
Hangs
HANGS
Main thread hang signatures
Disk Writes
DISK_WRITES
Excessive disk write signatures
Launches
LAUNCHES
Slow launch signatures
类型
--diagnostic-type
参数值
捕获内容
卡顿
HANGS
主线程卡顿特征
磁盘写入
DISK_WRITES
异常磁盘写入特征
启动
LAUNCHES
慢启动特征

Reading Results

结果解读

PerformanceMetric — one row per metric identifier (e.g.
launchTime
,
peakMemory
), flattened from the nested Xcode Metrics API. Key fields:
  • category
    — which metric group (LAUNCH, HANG, etc.)
  • latestValue
    +
    unit
    — most recent measurement
  • goalValue
    — Apple's recommended target
  • parentType
    "app"
    or
    "build"
    (tells you whether this came from app-level or build-level metrics)
DiagnosticSignatureInfo — a recurring issue pattern ranked by
weight
(% of occurrences). Higher weight = more impactful.
insightDirection
of
"UP"
means the issue is getting worse.
DiagnosticLogEntry — individual log with device metadata and
callStackSummary
(top 5 frames joined with
>
).
PerformanceMetric — 每个指标标识符对应一行数据(例如
launchTime
peakMemory
),由嵌套的Xcode Metrics API扁平化处理而来。核心字段:
  • category
    — 所属指标组(LAUNCH、HANG等)
  • latestValue
    +
    unit
    — 最新测量值
  • goalValue
    — Apple推荐的目标值
  • parentType
    "app"
    "build"
    (表示该数据来自应用级还是构建版本级指标)
DiagnosticSignatureInfo — 重复出现的问题模式,按
weight
(出现占比)排序。权重越高,影响越大。
insightDirection
"UP"
表示问题正在恶化。
DiagnosticLogEntry — 包含设备元数据和
callStackSummary
(前5个栈帧用
>
连接)的单个日志条目。

Full Command Reference

完整命令参考

See commands.md for all flags and examples.
查看commands.md获取所有参数与示例。