@swmansion/argent 0.12.1 → 0.13.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -117,17 +117,18 @@ argent init
117
117
 
118
118
  `argent init` auto-detects and configures MCP for:
119
119
 
120
- | Editor | Config location |
121
- | ----------- | ------------------------------------------------------------------------ |
122
- | Claude Code | `.mcp.json` (project) or `~/.claude.json` (global) |
123
- | Cursor | `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global) |
124
- | VS Code | `.vscode/mcp.json` |
125
- | Windsurf | `~/.codeium/windsurf/mcp_config.json` (global) |
126
- | Zed | `.zed/settings.json` |
127
- | Gemini CLI | `.gemini/settings.json` |
128
- | Codex CLI | `.codex/config.toml` (project) or `~/.codex/config.toml` (global) |
129
- | Hermes | `~/.hermes/config.yaml` (global) |
130
- | opencode | `opencode.json` (project) or `~/.config/opencode/opencode.json` (global) |
120
+ | Editor | Config location |
121
+ | ----------- | --------------------------------------------------------------------------- |
122
+ | Claude Code | `.mcp.json` (project) or `~/.claude.json` (global) |
123
+ | Cursor | `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global) |
124
+ | VS Code | `.vscode/mcp.json` |
125
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` (global) |
126
+ | Zed | `.zed/settings.json` |
127
+ | Gemini CLI | `.gemini/settings.json` |
128
+ | Codex CLI | `.codex/config.toml` (project) or `~/.codex/config.toml` (global) |
129
+ | Hermes | `~/.hermes/config.yaml` (global) |
130
+ | opencode | `opencode.json` (project) or `~/.config/opencode/opencode.json` (global) |
131
+ | Kiro | `.kiro/settings/mcp.json` (project) or `~/.kiro/settings/mcp.json` (global) |
131
132
 
132
133
  ## Privacy
133
134
 
@@ -1,10 +1,19 @@
1
1
  -- Argent — CPU hotspots.
2
2
  --
3
3
  -- One output row per (thread_name, leaf_function) — the leaf frame name IS the
4
- -- dominant function, so one SQL row maps 1:1 to one aggregateCpuHotspots group
5
- -- (we drop leaf_mapping, which was unused and only fragmented the grouping).
4
+ -- dominant function, so one SQL row maps 1:1 to one aggregateCpuHotspots group.
6
5
  -- The aggregator normalises the thread name and applies severity bands.
7
6
  --
7
+ -- We ALSO carry the leaf frame's mapping (the loaded object the symbol lives in,
8
+ -- e.g. `/system/lib64/libhwui.so` for app/framework code or `/kernel` for kernel
9
+ -- frames) through to the classifier. Name patterns alone can't tell `writel`
10
+ -- (a kernel MMIO write) from app code, but the mapping can: a leaf in `/kernel`
11
+ -- is unambiguously system/emulator overhead. To keep one output row per
12
+ -- (thread_name, leaf_function) — so the SQL→aggregator 1:1 mapping is preserved
13
+ -- and the grouping is NOT fragmented — the mapping is folded in with MIN() (a
14
+ -- given leaf symbol resolves to a single mapping in practice, so MIN is just a
15
+ -- grouping-safe pick, not a lossy aggregate).
16
+ --
8
17
  -- Burst windows are computed here in SQL rather than shipping every sample
9
18
  -- timestamp (the old `GROUP_CONCAT(ts_ns)` shipped ~54 KB of timestamps that
10
19
  -- JS re-parsed). A "burst" is a run of samples for the same (thread, function)
@@ -40,12 +49,14 @@ WITH samples AS (
40
49
  ps.ts AS ts_ns,
41
50
  t.name AS thread_name,
42
51
  t.is_main_thread AS is_main_thread,
43
- spf.name AS leaf_function
52
+ spf.name AS leaf_function,
53
+ spm.name AS leaf_mapping
44
54
  FROM perf_sample ps
45
55
  JOIN thread t USING (utid)
46
56
  JOIN process p USING (upid)
47
57
  LEFT JOIN stack_profile_callsite spc ON ps.callsite_id = spc.id
48
58
  LEFT JOIN stack_profile_frame spf ON spc.frame_id = spf.id
59
+ LEFT JOIN stack_profile_mapping spm ON spf.mapping = spm.id
49
60
  WHERE p.name = (SELECT target_process FROM _argent_args)
50
61
  ),
51
62
  -- Flag each sample whose gap to the previous sample of the same
@@ -53,7 +64,7 @@ WITH samples AS (
53
64
  -- NULL, so its CASE yields 0 — the opening sample never counts as a gap.
54
65
  flagged AS (
55
66
  SELECT
56
- thread_name, is_main_thread, leaf_function, ts_ns,
67
+ thread_name, is_main_thread, leaf_function, leaf_mapping, ts_ns,
57
68
  CASE
58
69
  WHEN ts_ns - LAG(ts_ns) OVER w > (SELECT burst_gap_ns FROM _argent_args) THEN 1
59
70
  ELSE 0
@@ -65,7 +76,7 @@ flagged AS (
65
76
  -- each thread+function partition.
66
77
  ided AS (
67
78
  SELECT
68
- thread_name, is_main_thread, leaf_function, ts_ns,
79
+ thread_name, is_main_thread, leaf_function, leaf_mapping, ts_ns,
69
80
  SUM(is_new_burst) OVER (
70
81
  PARTITION BY thread_name, leaf_function
71
82
  ORDER BY ts_ns
@@ -76,10 +87,13 @@ ided AS (
76
87
  -- Collapse each burst to [start_ns, end_ns, sample_count]. Every sample lands
77
88
  -- in exactly one burst, so summing burst counts == total samples and
78
89
  -- MIN/MAX of burst bounds == first/last sample of the (thread, function).
90
+ -- leaf_mapping is grouping-invariant per (thread, function), so MIN() picks it
91
+ -- without affecting the per-burst cardinality.
79
92
  per_burst AS (
80
93
  SELECT
81
94
  thread_name, leaf_function,
82
95
  MAX(is_main_thread) AS is_main_thread,
96
+ MIN(leaf_mapping) AS leaf_mapping,
83
97
  MIN(ts_ns) AS burst_start_ns,
84
98
  MAX(ts_ns) AS burst_end_ns,
85
99
  COUNT(*) AS burst_count
@@ -90,6 +104,9 @@ SELECT
90
104
  thread_name,
91
105
  MAX(is_main_thread) AS is_main_thread,
92
106
  leaf_function,
107
+ -- One mapping per (thread, function) group; MIN() keeps cardinality 1:1 with
108
+ -- the existing GROUP BY so the grouping is not fragmented.
109
+ MIN(leaf_mapping) AS leaf_mapping,
93
110
  SUM(burst_count) AS sample_count,
94
111
  MIN(burst_start_ns) AS first_ts_ns,
95
112
  MAX(burst_end_ns) AS last_ts_ns,
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file