s32trace-analyze-performance
Analyze an S32DS Performance View .perf export together with its ELF binary and project source tree to answer questions about function timing, call counts, hot functions, call-graph structure, and ann
Files1
View on GitHubSKILL.mdskills/s32trace/s32trace-analyze-performance/SKILL.md
GitHubS32Trace Performance Analysis
Answers performance questions from an S32DS Performance View export using three
local inputs: the .perf file, the ELF binary (with DWARF debug info), and the
project source tree.
When to use
Trigger this skill when the user wants to:
- load a
.perf+ ELF + source tree and get a performance overview - identify which functions consume the most CPU time (inclusive or exclusive)
- understand the call graph: who calls a function, and what it calls
- rank functions by call count to find frequently executed code
- view a source snippet for a hot function
- answer "where does the CPU spend most of its time?"
- answer "how many times was function X called?"
Do not use this skill to configure S32Trace (use s32trace-create-configuration),
analyze raw trace events (use s32trace-analyze-trace), or examine code coverage
(use s32trace-analyze-coverage).
Available Capabilities
| Type | Name | Purpose |
|---|---|---|
| MCP tool | search_actions |
discover available actions, their input schemas, and descriptions |
| MCP tool | execute_action |
validated dispatcher -- pass action_name + action-specific params |
All performance operations are routed through execute_action:
| Action name | Required params | Optional params |
|---|---|---|
performance.load |
perf_path, elf_path, source_root |
extra_source_roots, label, snippet_window |
performance.summary |
session_id |
core, top_k |
performance.function |
session_id, name |
core |
performance.hotspots |
session_id |
sort_by (inclusive/exclusive/calls), top_k, core |
performance.callgraph |
session_id, root |
depth, direction (callees/callers), core |
performance.get_source |
session_id |
symbol, file_hint, line, core, snippet_window |
Call search_actions first (or with a focused query such as "performance load")
to get the full parameter documentation before calling execute_action.
Typical workflow
performance.load -> returns session_id + load summary
-> performance.summary (overview: top functions by inclusive/exclusive time and call count)
-> performance.function (per-function detail + callers + callees)
-> performance.hotspots (ranked hotspot list by chosen metric)
-> performance.callgraph (nested call-tree from a root function, up or down)
-> performance.get_source (source snippet for a hot function)
Quickstart
- Call
search_actions(query="performance load")to confirm the action schema. - Ask the user for the
.perf, ELF, and source root paths. - Call
execute_action(action_name="performance.load", params={...}). Recordsession_id-- it is required by every subsequent call. - Unless the user has a specific question, call
performance.summaryand presenttop_by_inclusive_time(where most wall-clock time is spent),top_by_exclusive_time(self-time hot functions), andtop_by_call_count. - Answer follow-up questions using the action table above.
Workflow
Identify inputs. Confirm from the user:
- Absolute path to the
.perffile (perf_path). Typically at<workspace>/.AnalysisData/<session>/<name>.perf. - Absolute path to the ELF with DWARF debug info (
elf_path). Must be the exact binary that was profiled. - Absolute path to the project source root (
source_root). Needed forperformance.get_sourceto return annotated source text.
- Absolute path to the
Load the session. Call:
execute_action( action_name = "performance.load", params = { "perf_path": "<absolute path to .perf>", "elf_path": "<absolute path to .elf>", "source_root": "<absolute path to project src/>", "label": "my_perf_session" } )Verify:
function_count > 0,source.available: true.Get an overview. Call
performance.summaryunless the user has a specific question. Key fields to present:top_by_inclusive_time-- functions with the highest total accumulated timetop_by_exclusive_time-- functions with the highest self-time (ignoring callees)top_by_call_count-- most frequently called functions
Answer specific questions.
User question Action to call Key params "Where does the CPU spend time?" performance.summarytop_k"Which function has the most self-time?" performance.hotspotssort_by="exclusive""How many times was crc16_stepcalled?"performance.functionname="crc16_step_...""Show me the call graph for main"performance.callgraphroot="main""Who calls slow_leaf?"performance.callgraphroot="slow_leaf", direction="callers""What does slow_mid3call?"performance.callgraphroot="slow_mid3""Show me the source for the hottest function" performance.get_sourcesymbol=<name>Inline/mangled function names. S32DS names inlined copies as
funcname_0x<address>. When the user asks aboutclamp_i32:- Call
performance.hotspotsto list all instances. - Call
performance.functionwith the exact mangled name for per-instance detail.
- Call
Call-graph exploration. When the user asks "why is my main so slow?":
- Call
performance.callgraph(root="main", depth=3)to see the full downward tree. - Look for children with high
pct_inclusive. - Drill into those with
performance.functionfor per-callee breakdown. - Call
performance.get_sourceto view the actual code.
- Call
Guardrails
Scope
- All performance actions are read-only; no file is written and no S32DS process is started.
- Do not call configurator actions (
configurator.*) from this skill.
Destructive actions
- None.
performance.loadwrites only to an in-memory session cache; it does not touch any file.
Secrets
- No secrets or PII involved; no redaction required.
Refuse-and-escalate
performance.loadreturnserror: report the message verbatim and ask the user to verify the file paths.source.availableisfalseafter load: ask the user for the correctsource_root.performance.functionreturnsfound: false: useperformance.hotspotsfirst to confirm the exact symbol name (mangled names include the hex address).performance.callgraphnode markedtruncated=true: increasedepthparameter.- Stale
session_id: callperformance.loadagain and record the newsession_id.
Resource limits
- Default
top_kis 10 for summary and hotspots. Increase only when explicitly requested. - Default callgraph
depthis 3. Values above 6 may produce very large responses.
Validation loop
- After
performance.load, verifyfunction_count > 0and (whensource_rootgiven)source.available: true. - After
performance.summary, confirmtotal_functions > 0. - Pass criterion:
session_idis in hand and the load summary matches expectations (correct core, function count, source available).
Out of scope
- Creating or editing S32Trace configuration XML (use
s32trace-create-configuration). - Trace event analysis from a decoded CSV (use
s32trace-analyze-trace). - Code coverage analysis from a
.flatprofiler(uses32trace-analyze-coverage). - Timeline analysis from a
.timeline(uses32trace-analyze-timeline). - Compiling, flashing, or debugging firmware.
See Also
search_actions(query="performance")-- returns the full parameter schema for all 6performance.*actions.s32trace-analyze-coverage-- sibling skill for code coverage analysis.s32trace-analyze-timeline-- sibling skill for timeline / sampling analysis.s32trace-analyze-trace-- sibling skill for trace event / timing analysis.s32trace-create-configuration-- skill for configuring the trace capture.