spaa

SPAA (Stack Profile for Agentic Analysis) is an NDJSON file format for representing sampled performance stack traces. Each line is a self-contained JSON object with a type field.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "spaa" with this command: npx skills add andrewimm/spaa/andrewimm-spaa-spaa

Analyzing SPAA Files

SPAA (Stack Profile for Agentic Analysis) is an NDJSON file format for representing sampled performance stack traces. Each line is a self-contained JSON object with a type field.

Before analyzing an SPAA file, read the full specification at references/SPEC.md.

Quick Start

  1. Examine the header

The first line is always the header. It tells you what profiler generated the data and how to interpret metrics:

head -1 profile.spaa | jq .

Key header fields:

  • source_tool : The profiler that generated this data (e.g., "perf", "dtrace")

  • frame_order : Either "leaf_to_root" or "root_to_leaf"

  • determines how to read stack frames

  • events[].sampling.primary_metric : The authoritative metric for weighting (e.g., "period" for perf, "samples" for DTrace)

  1. Understand the record types

Count records by type

grep -o '"type":"[^"]*"' profile.spaa | sort | uniq -c | sort -rn

Common types:

  • header

  • File metadata (exactly one, always first)

  • dso

  • Shared libraries and binaries

  • frame

  • Individual stack frame definitions

  • thread

  • Thread/process info

  • stack

  • Aggregated call stacks with weights (the main data)

  • sample

  • Individual sample events (optional, for temporal analysis)

  1. Find performance hotspots

Extract the heaviest stacks by the primary metric:

For perf data (uses "period" metric)

grep '"type":"stack"' profile.spaa |
jq -s 'sort_by(-.weights[] | select(.metric=="period") | .value) | .[0:10]'

For DTrace data (uses "samples" metric)

grep '"type":"stack"' profile.spaa |
jq -s 'sort_by(-.weights[] | select(.metric=="samples") | .value) | .[0:10]'

  1. Find hot functions (exclusive time)

Exclusive time shows where the CPU actually spent time, not just functions on the call path:

grep '"type":"stack"' profile.spaa |
jq -s '[.[] | select(.exclusive) | {frame: .exclusive.frame, value: (.exclusive.weights[] | select(.metric=="period") | .value)}] | group_by(.frame) | map({frame: .[0].frame, total: (map(.value) | add)}) | sort_by(-.total) | .[0:20]'

Then look up the frame IDs to get function names:

Get frame details for a specific ID

grep '"type":"frame"' profile.spaa | jq 'select(.id == 101)'

Analyzing Memory Profiles

SPAA also supports heap/allocation profilers. Memory events use different metrics:

Find top allocation sites by bytes allocated

grep '"type":"stack"' profile.spaa |
jq -s '[.[] | select(.weights[] | .metric == "alloc_bytes")] | sort_by(-.weights[] | select(.metric=="alloc_bytes") | .value) | .[0:10]'

Find potential memory leaks (high live_bytes)

grep '"type":"stack"' profile.spaa |
jq -s '[.[] | select(.weights[] | .metric == "live_bytes")] | sort_by(-.weights[] | select(.metric=="live_bytes") | .value) | .[0:10]'

Key memory metrics:

  • alloc_bytes / alloc_count

  • Total allocations

  • live_bytes / live_count

  • Currently unreleased memory (potential leaks)

  • peak_bytes

  • High-water mark

Reconstructing Call Stacks

Stack records contain frame IDs. To see the actual function names:

Extract a stack and resolve its frames

STACK_FRAMES=$(grep '"type":"stack"' profile.spaa | head -1 | jq -r '.frames | @csv')

Build a frame lookup table, then query it

grep '"type":"frame"' profile.spaa | jq -s 'INDEX(.id)' > /tmp/frames.json echo $STACK_FRAMES | tr ',' '\n' | while read fid; do jq --arg id "$fid" '.[$id] | "(.func) ((.srcline // "unknown"))"' /tmp/frames.json done

Common Analysis Patterns

Filter by thread/process

grep '"type":"stack"' profile.spaa | jq 'select(.context.tid == 4511)'

Filter by event type

grep '"type":"stack"' profile.spaa | jq 'select(.context.event == "cycles")'

Find kernel vs userspace time

Kernel stacks

grep '"type":"stack"' profile.spaa | jq 'select(.stack_type == "kernel")'

Or check frame kinds

grep '"type":"frame"' profile.spaa | jq 'select(.kind == "kernel")' | head -20

Temporal analysis (if sample records exist)

Check if raw samples are included

grep -c '"type":"sample"' profile.spaa

Plot sample distribution over time

grep '"type":"sample"' profile.spaa | jq -s 'group_by(.timestamp | floor) | map({time: .[0].timestamp | floor, count: length})'

Tips for Performance Analysis

  • Start with the header - Understand the profiler, sampling mode, and time range

  • Check the primary metric - Use period for perf, samples for DTrace

  • Look at exclusive time first - This shows actual hotspots, not just callers

  • Cross-reference frame IDs - Build a lookup table for readable output

  • Filter by context - Narrow down by thread, CPU, or event type

  • For memory issues - Focus on live_bytes to find leaks, alloc_bytes for churn

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

analyze-bundle

No summary provided by upstream source.

Repository SourceNeeds Review
Research

Survey Designer

问卷设计工具。创建专业问卷、添加题型、设置逻辑跳转、数据分析、模板库、多格式导出。Survey designer with question types, skip logic, analysis, templates, and export. Use when you need survey designer...

Registry SourceRecently Updated
Research

test

Competitor monitoring, pricing analysis, market positioning, and SWOT generation. Use when you need to track competitor moves, benchmark pricing, analyze mar...

Registry SourceRecently Updated
Research

Agent Fact Check Verify

嚴謹多來源資訊查核與可信度判定技能。用於「查證/核實/核實這個/是真的嗎/是否正確」類請求,整合政府、官方、主流媒體、事實查核站、X(Twitter)、Reddit 等來源,採用內部 100 分制規則化評分(不對使用者公開分數),對外輸出中立且整合式結論。

Registry SourceRecently Updated