Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

axiom-concurrency-profilingAxiom 并发分析

Agent Skill

axiom-concurrency-profiling 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,110

周安装

173

GitHub Stars

873

下载量

1,439
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:axiom-concurrency-profiling(Axiom 并发分析)
来源仓库:https://github.com/charleswiltgen/axiom
仓库路径:skills/axiom-concurrency-profiling
安装命令:
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-concurrency-profiling
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-concurrency-profiling

简介

使用 Instruments 分析 Swift 异步代码性能与阻塞问题。

  • 追踪任务生命周期与 actor 执行流可视化。
  • 适用于 UI 卡顿与主线程阻塞的根因定位。
  • 需配合 Time Profiler 与 Allocations 工具交叉验证结果。
  • axiom-concurrency-profiling 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Concurrency Profiling — Instruments Workflows

Profile and optimize Swift async/await code using Instruments.

When to Use

Use when:

  • UI stutters during async operations
  • Suspecting actor contention
  • Tasks queued but not executing
  • Main thread blocked during async work
  • Need to visualize task execution flow

Don't use when:

  • Issue is pure CPU performance (use Time Profiler)
  • Memory issues unrelated to concurrency (use Allocations)
  • Haven't confirmed concurrency is the bottleneck

Swift Concurrency Template

What It Shows

TrackInformation
Swift TasksTask lifetimes, parent-child relationships
Swift ActorsActor access, contention visualization
Thread StatesBlocked vs running vs suspended

Statistics

  • Running Tasks: Tasks currently executing
  • Alive Tasks: Tasks present at a point in time
  • Total Tasks: Cumulative count created

Color Coding

  • Blue: Task executing
  • Red: Task waiting (contention)
  • Gray: Task suspended (awaiting)

Workflow 1: Diagnose Main Thread Blocking

Symptom: UI freezes, main thread timeline full

  1. Profile with Swift Concurrency template
  2. Look at main thread → "Swift Tasks" lane
  3. Find long blue bars (task executing on main)
  4. Check if work could be offloaded

Solution patterns:

// ❌ Heavy work on MainActor
@MainActor
class ViewModel: ObservableObject {
    func process() {
        let result = heavyComputation()  // Blocks UI
        self.data = result
    }
}

// ✅ Offload heavy work
@MainActor
class ViewModel: ObservableObject {
    func process() async {
        let result = await Task.detached {
            heavyComputation()
        }.value
        self.data = result
    }
}

Workflow 2: Find Actor Contention

Symptom: Tasks serializing unexpectedly, parallel work running sequentially

  1. Enable "Swift Actors" instrument
  2. Look for serialized access patterns
  3. Red = waiting, Blue = executing
  4. High red:blue ratio = contention problem

Solution patterns:

// ❌ All work serialized through actor
actor DataProcessor {
    func process(_ data: Data) -> Result {
        heavyProcessing(data)  // All callers wait
    }
}

// ✅ Mark heavy work as nonisolated
actor DataProcessor {
    nonisolated func process(_ data: Data) -> Result {
        heavyProcessing(data)  // Runs in parallel
    }

    func storeResult(_ result: Result) {
        // Only actor state access serialized
    }
}

More fixes:

  • Split actor into multiple (domain separation)
  • Use Mutex for hot paths (faster than actor hop)
  • Reduce actor scope (fewer isolated properties)

Workflow 3: Thread Pool Exhaustion

Symptom: Tasks queued but not executing, gaps in task execution

Cause: Blocking calls exhaust cooperative pool

  1. Look for gaps in task execution across all threads
  2. Check for blocking primitives
  3. Replace with async equivalents

Common culprits:

// ❌ Blocks cooperative thread
Task {
    semaphore.wait()  // NEVER do this
    // ...
    semaphore.signal()
}

// ❌ Synchronous file I/O in async context
Task {
    let data = Data(contentsOf: fileURL)  // Blocks
}

// ✅ Use async APIs
Task {
    let (data, _) = try await URLSession.shared.data(from: fileURL)
}

Debug flag:

SWIFT_CONCURRENCY_COOPERATIVE_THREAD_BOUNDS=1

Detects unsafe blocking in async context.

Workflow 4: Priority Inversion

Symptom: High-priority task waits for low-priority

  1. Inspect task priorities in Instruments
  2. Follow wait chains
  3. Ensure critical paths use appropriate priority
// ✅ Explicit priority for critical work
Task(priority: .userInitiated) {
    await criticalUIUpdate()
}

Thread Pool Model

Swift uses a cooperative thread pool matching CPU core count:

AspectGCDSwift Concurrency
ThreadsGrows unboundedFixed to core count
BlockingCreates new threadsSuspends, frees thread
DependenciesHiddenRuntime-tracked
Context switchFull kernel switchLightweight continuation

Why blocking is catastrophic:

  • Each blocked thread holds memory + kernel structures
  • Limited threads means blocked = no progress
  • Pool exhaustion deadlocks the app

Quick Checks (Before Profiling)

Run these checks first:

  1. Is work actually async?

- Look for suspension points (await) - Sync code in async function still blocks

  1. Holding locks across await? // ❌ Deadlock risk mutex.withLock {await something() // Never!}
  2. Tasks in tight loops? // ❌ Overhead may exceed benefit for item in items {Task {process(item)}} // ✅ Structured concurrency await withTaskGroup(of: Void.self) {group in for item in items {group.addTask {process(item)}}}
  3. DispatchSemaphore in async context?

- Always unsafe — use withCheckedContinuation instead

Common Issues Summary

IssueSymptom in InstrumentsFix
MainActor overloadLong blue bars on mainTask.detached, nonisolated
Actor contentionHigh red:blue ratioSplit actors, use nonisolated
Thread exhaustionGaps in all threadsRemove blocking calls
Priority inversionHigh-pri waits for low-priCheck task priorities
Too many tasksTask creation overheadUse task groups

Safe vs Unsafe Primitives

Safe with cooperative pool:

  • await, actors, task groups
  • os_unfair_lock, NSLock (short critical sections)
  • Mutex (iOS 18+)

Unsafe (violate forward progress):

  • DispatchSemaphore.wait()
  • pthread_cond_wait
  • Sync file/network I/O
  • Thread.sleep() in Task

Resources

WWDC: 2022-110350, 2021-10254

Docs: /xcode/improving-app-responsiveness

Skills: axiom-swift-concurrency, axiom-performance-profiling, axiom-synchronization, axiom-lldb (interactive thread state inspection)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.09%
按下载量换算375

Codex

19.94%
按下载量换算287

OpenCode

18.07%
按下载量换算260

Antigravity

12.44%
按下载量换算179

Cursor

8.05%
按下载量换算116

windsurf

3.62%
按下载量换算52

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills