asc-performance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePower & Performance with asc
asc借助asc
管理功耗与性能
ascDownload 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.p8bash
asc auth login --key-id <id> --issuer-id <id> --private-key-path ~/.asc/AuthKey.p8How to Navigate (CAEOAS Affordances)
操作导航(CAEOAS 功能入口)
Every JSON response contains an field with ready-to-run commands — IDs already filled in. Follow the affordances to drill down from metrics to diagnostics to logs.
"affordances"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响应都包含一个字段,其中填充了可直接运行的命令(已自动填入ID)。按照该字段的指引,可从指标逐步深入到诊断信息,再到日志。
"affordances"应用指标 → 诊断信息 → 日志流程:
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 --prettybash
asc perf-metrics list --app-id 123456789 --prettyInvestigate a specific metric type
排查特定类型的指标
bash
undefinedbash
undefinedLaunch 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
undefinedasc perf-metrics list --app-id 123456789 --metric-type HANG --pretty
undefinedCompare build-specific metrics
对比不同构建版本的指标
bash
asc builds list --app-id 123456789 --output table
asc perf-metrics list --build-id build-abc --prettybash
asc builds list --app-id 123456789 --output table
asc perf-metrics list --build-id build-abc --prettyDiagnose hangs in a build
诊断构建版本中的卡顿问题
bash
undefinedbash
undefined1. 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
undefinedasc diagnostic-logs list --signature-id sig-1 --pretty
undefinedFull investigation pipeline
完整排查流程
bash
undefinedbash
undefinedStart 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
| jq -r '.data | sort_by(-.weight) | .[0].id') asc diagnostic-logs list --signature-id "$SIG_ID" --pretty
undefinedSIG_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
| jq -r '.data | sort_by(-.weight) | .[0].id') asc diagnostic-logs list --signature-id "$SIG_ID" --pretty
undefinedPerformance Metric Categories
性能指标分类
| Category | | What it measures |
|---|---|---|
| Launch | | App launch time |
| Hang | | Main thread hang rate |
| Memory | | Peak and average memory use |
| Disk | | Disk write volume |
| Battery | | Energy impact |
| Termination | | Background/foreground terminations |
| Animation | | Animation hitch rate |
| 分类 | | 衡量内容 |
|---|---|---|
| 启动 | | 应用启动时间 |
| 卡顿 | | 主线程卡顿率 |
| 内存 | | 峰值与平均内存占用 |
| 磁盘 | | 磁盘写入量 |
| 电池 | | 能耗影响 |
| 进程终止 | | 后台/前台进程终止情况 |
| 动画 | | 动画卡顿率 |
Diagnostic Types
诊断类型
| Type | | What it captures |
|---|---|---|
| Hangs | | Main thread hang signatures |
| Disk Writes | | Excessive disk write signatures |
| Launches | | Slow launch signatures |
| 类型 | | 捕获内容 |
|---|---|---|
| 卡顿 | | 主线程卡顿特征 |
| 磁盘写入 | | 异常磁盘写入特征 |
| 启动 | | 慢启动特征 |
Reading Results
结果解读
PerformanceMetric — one row per metric identifier (e.g. , ), flattened from the nested Xcode Metrics API. Key fields:
launchTimepeakMemory- — which metric group (LAUNCH, HANG, etc.)
category - +
latestValue— most recent measurementunit - — Apple's recommended target
goalValue - —
parentTypeor"app"(tells you whether this came from app-level or build-level metrics)"build"
DiagnosticSignatureInfo — a recurring issue pattern ranked by (% of occurrences). Higher weight = more impactful. of means the issue is getting worse.
weightinsightDirection"UP"DiagnosticLogEntry — individual log with device metadata and (top 5 frames joined with ).
callStackSummary>PerformanceMetric — 每个指标标识符对应一行数据(例如、),由嵌套的Xcode Metrics API扁平化处理而来。核心字段:
launchTimepeakMemory- — 所属指标组(LAUNCH、HANG等)
category - +
latestValue— 最新测量值unit - — Apple推荐的目标值
goalValue - —
parentType或"app"(表示该数据来自应用级还是构建版本级指标)"build"
DiagnosticSignatureInfo — 重复出现的问题模式,按(出现占比)排序。权重越高,影响越大。为表示问题正在恶化。
weightinsightDirection"UP"DiagnosticLogEntry — 包含设备元数据和(前5个栈帧用连接)的单个日志条目。
callStackSummary>Full Command Reference
完整命令参考
See commands.md for all flags and examples.
查看commands.md获取所有参数与示例。