diff --git a/README.md b/README.md index 47d134c..eb903e5 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,10 @@ See the [full quick start guide](docs/en/quickstart.md) for a walkthrough. `pt-snap --help` includes an agent hint: prefer `--json` on the command that supports it, start with the `pt-snap-helper` skill, use `pt-snap capabilities --json` and `pt-snap overview --json` before diagnosing, and check availability with `pt-snap skill list --json`. `focus`, `import`, `split`, `query`, `config`, `capabilities`, `overview`, `metadata`, `report peak-memory`, and `skill list/install/upgrade/uninstall` accept `--json`. +Peak reports expose attribution completeness and same-event active-byte coverage; +group percentages use included bytes after filtering and ranking. See the +[report guide](docs/en/querying.md#report-command) before interpreting a capped breakdown. + ## Agent Skills Install bundled diagnostic workflows with `pt-snap skill install`. Agent integration uses skills plus the CLI; there is no MCP server. See the [Agent Skills guide](docs/en/skills.md). diff --git a/README_zh.md b/README_zh.md index 0375ce1..dccdcba 100644 --- a/README_zh.md +++ b/README_zh.md @@ -64,6 +64,10 @@ pt-snap split snapshot.pkl --slices 4 --output snapshot-slices `pt-snap --help` 含 Agent 提示:在支持该选项的命令上优先使用 `--json`,从 `pt-snap-helper` skill 开始,诊断前先用 `pt-snap capabilities --json` 和 `pt-snap overview --json`,并用 `pt-snap skill list --json` 检查是否已安装。`focus`、`import`、`split`、`query`、`config`、`capabilities`、`overview`、`metadata`、`report peak-memory` 和 `skill list/install/upgrade/uninstall` 均接受 `--json`。 +峰值报告会返回归因完整性及同事件 active 字节覆盖率;分组百分比以筛选和排名后的 +included bytes 为分母。解读有上限的分组结果前,请参阅 +[报告指南](docs/zh/querying.md#report-命令)。 + ## Agent Skills 使用 `pt-snap skill install` 安装随包诊断工作流。Agent 集成入口是 skills 与 CLI,不再提供 MCP 服务器。详见 [Agent Skills 指南](docs/zh/skills.md)。 diff --git a/docs/en/querying.md b/docs/en/querying.md index d30fa8b..e82512e 100644 --- a/docs/en/querying.md +++ b/docs/en/querying.md @@ -247,6 +247,25 @@ The report command combines: and prints either a human-readable summary or JSON. +The existing `callstack_groups` and `percent_of_active_blocks` values are preserved. +JSON also exposes attribution `has_more`, `truncated`, `total_is_exact`, and +`effective_params` (`event_id`, `include_static`, `min_size`, `top_n`). A full +dynamic `top_n` window is conservatively **possibly incomplete**, even when it +happens to contain every group. Text output labels this as partial. Increase +`--limit` within a finite budget and replace the previous result; do not add +ranked windows together. Static and preexisting groups are extra rows outside +the dynamic `--limit` cap when included. + +`included_bytes` sums all returned groups. `percent_denominator: "included_bytes"` +means row percentages are byte shares of this filtered/capped set, not all active +memory or block counts. `active_bytes_at_event` is the active counter at the +**selected metric's event**, including for allocated/reserved reports. +`coverage_percent` is `100 * included_bytes / active_bytes_at_event`; it is `null` +(text: unknown) when that counter is absent or non-positive, or no event exists. +Coverage is not a completeness flag: `--exclude-static` can lower it without +truncation, and reaching the cap can remain possibly incomplete at 100% coverage. +An empty trace returns no groups, zero included bytes, and unknown coverage. + ## JSON Output `--json` writes one JSON object to stdout. Success payloads include diff --git a/docs/zh/querying.md b/docs/zh/querying.md index 98de48b..8caed81 100644 --- a/docs/zh/querying.md +++ b/docs/zh/querying.md @@ -231,6 +231,22 @@ pt-snap report peak-memory /path/to/snapshot.db --json 并输出人类可读摘要或 JSON。 +原有 `callstack_groups` 和 `percent_of_active_blocks` 数值保持不变。JSON 还会 +返回归因的 `has_more`、`truncated`、`total_is_exact` 和 `effective_params` +(`event_id`、`include_static`、`min_size`、`top_n`)。动态分组恰好填满 `top_n` +窗口时会保守标记为**可能不完整**,即使实际上已包含所有分组;文本输出显示 partial。 +可在有限预算内增大 `--limit`,用新结果替换旧结果,不要把不同排名窗口累加。 +包含静态内存时,static 和 preexisting 分组是动态 `--limit` 上限之外的额外行。 + +`included_bytes` 是所有返回分组的字节总和。`percent_denominator: "included_bytes"` +说明行百分比是筛选、截断后集合的字节占比,而非全部 active 内存或块数量的占比。 +`active_bytes_at_event` 是**所选 metric 对应事件**的 active counter,对 allocated +和 reserved 报告也一样。`coverage_percent` 为 +`100 * included_bytes / active_bytes_at_event`;该 counter 缺失、非正数或没有事件时 +为 `null`(文本显示 unknown)。覆盖率不是完整性标志:`--exclude-static` 可以在 +没有截断时降低覆盖率,而满窗口即使覆盖率达到 100% 也仍可能不完整。 +空 trace 返回空分组、零 included bytes 和未知覆盖率。 + ## JSON 输出 `--json` 向 stdout 写一个 JSON 对象。成功结果包含 `schema_version`(当前为 `1`)、 diff --git a/skills/pt-snap-memory-fragmentation/SKILL.md b/skills/pt-snap-memory-fragmentation/SKILL.md index 39c4878..5dff8be 100644 --- a/skills/pt-snap-memory-fragmentation/SKILL.md +++ b/skills/pt-snap-memory-fragmentation/SKILL.md @@ -335,6 +335,23 @@ those callstacks. Keep static and dynamic active-block groups distinct. The callstack template has no `offset`; if `has_more` or `truncated` is true, increase `top_n` instead of treating the ranked page as complete. +For reports, inspect `has_more`, `truncated`, `total_is_exact`, and +`effective_params` too. A full dynamic cap means possibly incomplete, not +proven omissions. Widen report `--limit` (or query `top_n`, with `-n` at least +`top_n + 2` for special groups) at most twice, for example 20 → 40 → 80, within +a finite agreed budget. Replace prior ranked windows; do not sum them or use +unlimited expansion. If still flagged, retain an explicit partial conclusion. +If an older report lacks these fields, use the verified bounded callstack +query rather than assuming completeness. + +Preserve report `included_bytes`, `percent_denominator`, +`active_bytes_at_event`, and `coverage_percent`. Row percentages describe +included bytes after filtering/top_n, not all active memory. Coverage uses the +active counter at the selected event, never reserved bytes or an independent +active peak; NULL coverage is unknown. Excluding static/preexisting memory may +lower coverage without truncation, and 100% coverage does not override cap-hit +flags. These values do not measure fragmentation or explain allocator gaps. + Do not use `callstack_analysis` as segment-source attribution. Its query has no action filter, so it mixes event types and cannot identify which callstack caused segment mapping, acquisition, retention, cache bytes, or fragmentation. diff --git a/skills/pt-snap-memory-peak-breakdown/SKILL.md b/skills/pt-snap-memory-peak-breakdown/SKILL.md index f66ea2d..6b937ba 100644 --- a/skills/pt-snap-memory-peak-breakdown/SKILL.md +++ b/skills/pt-snap-memory-peak-breakdown/SKILL.md @@ -196,6 +196,25 @@ occurred together. The repeated `peak` and `allocator_gap` sections should agree across all three reports; the metric-specific `event_id` and `callstack_groups` are the selected-event breakdown. +Read report `has_more`, `truncated`, `total_is_exact`, and `effective_params` +before claiming a complete composition. A full dynamic `top_n` window means +possibly incomplete, not proven omissions. If either flag is true, widen +`--limit` at most twice (for example 20 → 40 → 80), within a finite agreed +budget; replace prior results rather than summing ranked windows. If still +flagged, report partial attribution and stop expanding. Never default to an +unlimited query. Static/preexisting groups are extra rows outside `top_n`. + +Report `included_bytes`, `percent_denominator`, `active_bytes_at_event`, and +`coverage_percent` with the composition. The percentage denominator is included +bytes after filtering/top_n, not all active memory. Coverage uses active bytes +at this selected event even for allocated/reserved peaks; never divide by an +independent active peak or by reserved bytes. NULL coverage is unknown. +`--exclude-static` can lower coverage without truncation; 100% coverage does +not override conservative cap-hit flags. If an older report lacks these fields, +do not assume completeness: use the verified callstack query with a finite +`top_n` and `-n` at least `top_n + 2` to retain both special categories, and +preserve its completeness flags and included-byte denominator. + ### Representative blocks Use `active_blocks_at_event` at the chosen metric's peak event, not at the end of diff --git a/src/pt_snap_cli/bundled_skills/pt-snap-memory-fragmentation/SKILL.md b/src/pt_snap_cli/bundled_skills/pt-snap-memory-fragmentation/SKILL.md index 39c4878..5dff8be 100644 --- a/src/pt_snap_cli/bundled_skills/pt-snap-memory-fragmentation/SKILL.md +++ b/src/pt_snap_cli/bundled_skills/pt-snap-memory-fragmentation/SKILL.md @@ -335,6 +335,23 @@ those callstacks. Keep static and dynamic active-block groups distinct. The callstack template has no `offset`; if `has_more` or `truncated` is true, increase `top_n` instead of treating the ranked page as complete. +For reports, inspect `has_more`, `truncated`, `total_is_exact`, and +`effective_params` too. A full dynamic cap means possibly incomplete, not +proven omissions. Widen report `--limit` (or query `top_n`, with `-n` at least +`top_n + 2` for special groups) at most twice, for example 20 → 40 → 80, within +a finite agreed budget. Replace prior ranked windows; do not sum them or use +unlimited expansion. If still flagged, retain an explicit partial conclusion. +If an older report lacks these fields, use the verified bounded callstack +query rather than assuming completeness. + +Preserve report `included_bytes`, `percent_denominator`, +`active_bytes_at_event`, and `coverage_percent`. Row percentages describe +included bytes after filtering/top_n, not all active memory. Coverage uses the +active counter at the selected event, never reserved bytes or an independent +active peak; NULL coverage is unknown. Excluding static/preexisting memory may +lower coverage without truncation, and 100% coverage does not override cap-hit +flags. These values do not measure fragmentation or explain allocator gaps. + Do not use `callstack_analysis` as segment-source attribution. Its query has no action filter, so it mixes event types and cannot identify which callstack caused segment mapping, acquisition, retention, cache bytes, or fragmentation. diff --git a/src/pt_snap_cli/bundled_skills/pt-snap-memory-peak-breakdown/SKILL.md b/src/pt_snap_cli/bundled_skills/pt-snap-memory-peak-breakdown/SKILL.md index f66ea2d..6b937ba 100644 --- a/src/pt_snap_cli/bundled_skills/pt-snap-memory-peak-breakdown/SKILL.md +++ b/src/pt_snap_cli/bundled_skills/pt-snap-memory-peak-breakdown/SKILL.md @@ -196,6 +196,25 @@ occurred together. The repeated `peak` and `allocator_gap` sections should agree across all three reports; the metric-specific `event_id` and `callstack_groups` are the selected-event breakdown. +Read report `has_more`, `truncated`, `total_is_exact`, and `effective_params` +before claiming a complete composition. A full dynamic `top_n` window means +possibly incomplete, not proven omissions. If either flag is true, widen +`--limit` at most twice (for example 20 → 40 → 80), within a finite agreed +budget; replace prior results rather than summing ranked windows. If still +flagged, report partial attribution and stop expanding. Never default to an +unlimited query. Static/preexisting groups are extra rows outside `top_n`. + +Report `included_bytes`, `percent_denominator`, `active_bytes_at_event`, and +`coverage_percent` with the composition. The percentage denominator is included +bytes after filtering/top_n, not all active memory. Coverage uses active bytes +at this selected event even for allocated/reserved peaks; never divide by an +independent active peak or by reserved bytes. NULL coverage is unknown. +`--exclude-static` can lower coverage without truncation; 100% coverage does +not override conservative cap-hit flags. If an older report lacks these fields, +do not assume completeness: use the verified callstack query with a finite +`top_n` and `-n` at least `top_n + 2` to retain both special categories, and +preserve its completeness flags and included-byte denominator. + ### Representative blocks Use `active_blocks_at_event` at the chosen metric's peak event, not at the end of diff --git a/src/pt_snap_cli/cli_output.py b/src/pt_snap_cli/cli_output.py index 8be388e..375d8ad 100644 --- a/src/pt_snap_cli/cli_output.py +++ b/src/pt_snap_cli/cli_output.py @@ -134,6 +134,29 @@ def print_peak_memory_report(report: PeakMemoryReport) -> None: typer.echo() typer.secho("Active memory by callstack:", fg=typer.colors.GREEN, bold=True) + if report.event_id is None: + typer.echo(" Attribution: unavailable (no peak event).") + elif report.has_more or report.truncated: + typer.echo(" Attribution: partial / possibly incomplete (dynamic top_n cap reached).") + typer.echo(" Increase --limit within a finite budget to check for additional groups.") + else: + typer.echo(" Attribution: complete for the effective filters.") + typer.echo( + f" Parameters: include_static={report.effective_params.get('include_static')}, " + f"min_size={report.effective_params.get('min_size')}, " + f"top_n={report.effective_params.get('top_n')}" + ) + typer.echo( + f" Percentage denominator: {report.percent_denominator}={report.included_bytes} bytes " + "(included groups after filtering/top_n; not all active memory or block counts)." + ) + coverage = ( + f"{report.coverage_percent:.4f}%" if report.coverage_percent is not None else "unknown" + ) + typer.echo( + f" Active coverage at event {report.event_id}: {coverage} " + f"(included={report.included_bytes} bytes, active={report.active_bytes_at_event} bytes)." + ) if not report.callstack_groups: typer.echo(" No active memory callstack groups found.") return diff --git a/src/pt_snap_cli/cli_reports.py b/src/pt_snap_cli/cli_reports.py index 4923846..7e384fe 100644 --- a/src/pt_snap_cli/cli_reports.py +++ b/src/pt_snap_cli/cli_reports.py @@ -58,7 +58,12 @@ def report_peak_memory( bool, typer.Option("--include-static/--exclude-static", help="Include static memory group"), ] = True, - limit: Annotated[int, typer.Option("--limit", "-n", help="Maximum callstack groups")] = 20, + limit: Annotated[ + int, + typer.Option( + "--limit", "-n", help="Maximum dynamic callstack groups (static/preexisting are extra)" + ), + ] = 20, json_output: Annotated[bool, _json_flag()] = False, ) -> None: """Generate a peak memory attribution report.""" diff --git a/src/pt_snap_cli/core/models.py b/src/pt_snap_cli/core/models.py index 71b6253..0201e26 100644 --- a/src/pt_snap_cli/core/models.py +++ b/src/pt_snap_cli/core/models.py @@ -117,6 +117,14 @@ class PeakMemoryReport: peak: dict[str, object] allocator_gap: dict[str, object] | None callstack_groups: list[dict[str, object]] + has_more: bool = False + truncated: bool = False + total_is_exact: bool = False + effective_params: dict[str, object] = field(default_factory=dict) + included_bytes: int = 0 + percent_denominator: str = "included_bytes" + active_bytes_at_event: int | None = None + coverage_percent: float | None = None @dataclass(frozen=True) diff --git a/src/pt_snap_cli/core/report_service.py b/src/pt_snap_cli/core/report_service.py index e4a7fbf..f618f84 100644 --- a/src/pt_snap_cli/core/report_service.py +++ b/src/pt_snap_cli/core/report_service.py @@ -15,6 +15,12 @@ "reserved": "peak_reserved_event_id", } +_ACTIVE_COUNTER_BY_METRIC = { + "active": "peak_active", + "allocated": "active_at_allocated_peak", + "reserved": "active_at_reserved_peak", +} + class ReportService: def __init__(self, focus_service: FocusService | None = None) -> None: @@ -48,6 +54,12 @@ def peak_memory_report( peak = peak_result.rows[0] if peak_result.rows else {} # memory_peak selects an INTEGER event ID (or NULL for an empty trace). event_id = cast(int | None, peak.get(_EVENT_ID_BY_METRIC[metric])) + attribution_params: dict[str, object] = { + "event_id": event_id, + "include_static": include_static, + "min_size": 0, + "top_n": limit, + } if event_id is None: return PeakMemoryReport( @@ -57,6 +69,8 @@ def peak_memory_report( peak=peak, allocator_gap=None, callstack_groups=[], + total_is_exact=True, + effective_params=attribution_params, ) gap_result = self._query_service.execute_query( @@ -67,21 +81,37 @@ def peak_memory_report( ) callstack_result = self._query_service.execute_query( "active_memory_callstack_at_event", - params={ - "event_id": event_id, - "include_static": include_static, - "top_n": limit, - }, + params=attribution_params, db_path=db_path, device_id=device_id, start_dir=start_dir, ) + gap = gap_result.rows[0] if gap_result.rows else None + # allocator_gap supplies the active counter at this metric's event, + # not the independently occurring active high-water value. + active_bytes = cast(int | None, (gap or {}).get(_ACTIVE_COUNTER_BY_METRIC[metric])) + # No caller-side max_rows cap: these are all rows in the SQL percentage + # denominator, including static/preexisting groups outside top_n. + included_bytes = sum(cast(int, row["size_bytes"]) for row in callstack_result.rows) + coverage = ( + included_bytes * 100.0 / active_bytes + if active_bytes is not None and active_bytes > 0 + else None + ) + return PeakMemoryReport( device_id=peak_result.device_id, metric=metric, event_id=event_id, peak=peak, - allocator_gap=gap_result.rows[0] if gap_result.rows else None, + allocator_gap=gap, callstack_groups=callstack_result.rows, + has_more=callstack_result.has_more, + truncated=callstack_result.truncated, + total_is_exact=callstack_result.total_is_exact, + effective_params=attribution_params, + included_bytes=included_bytes, + active_bytes_at_event=active_bytes, + coverage_percent=coverage, ) diff --git a/tests/test_peak_report_completeness.py b/tests/test_peak_report_completeness.py new file mode 100644 index 0000000..ef91130 --- /dev/null +++ b/tests/test_peak_report_completeness.py @@ -0,0 +1,166 @@ +"""Real-SQLite report coverage and completeness contracts across CLI formats.""" + +import json +import sqlite3 +from contextlib import closing +from pathlib import Path + +import pytest +from typer.testing import CliRunner + +from pt_snap_cli.api import SnapshotAnalyzer +from pt_snap_cli.cli import app +from pt_snap_cli.query.registry import QueryRegistry, _load_all_templates + + +@pytest.fixture +def attribution_db(tmp_path: Path) -> Path: + QueryRegistry.reset() + _load_all_templates() + db = tmp_path / "attribution.db" + with closing(sqlite3.connect(db)) as conn, conn: + conn.executescript(""" + CREATE TABLE dictionary (`table` TEXT, `column` TEXT, `key` TEXT, `value` TEXT); + CREATE TABLE callstack (id INTEGER PRIMARY KEY, callstack TEXT); + CREATE TABLE trace_entry_0 ( + id INTEGER PRIMARY KEY, action INTEGER, address INTEGER, size INTEGER, + stream INTEGER, allocated INTEGER, active INTEGER, reserved INTEGER, + callstackId INTEGER + ); + CREATE TABLE block_0 ( + id INTEGER PRIMARY KEY, address INTEGER, size INTEGER, + requestedSize INTEGER, state INTEGER, allocEventId INTEGER, freeEventId INTEGER + ); + INSERT INTO callstack VALUES (2, 'second'), (3, 'third'); + INSERT INTO trace_entry_0 VALUES + (1, 4, 10, 10, 0, 160, 160, 1000, NULL), + (2, 4, 20, 20, 0, 180, 180, 900, 2), + (3, 4, 30, 30, 0, 175, 210, 900, 3); + INSERT INTO block_0 VALUES + (-1, 100, 100, NULL, 1, -1, -1), + (-2, 200, 50, 50, 1, -1, 4), + (1, 10, 10, NULL, 1, 1, -1), + (2, 20, 20, 20, 1, 2, -1), + (3, 30, 30, 30, 1, 3, -1); + """) + return db + + +@pytest.mark.parametrize( + "metric,event_id,active", [("active", 3, 210), ("allocated", 2, 180), ("reserved", 1, 160)] +) +@pytest.mark.parametrize("limit", [1, 2, 3, 4, -1]) +@pytest.mark.parametrize("include_static", [True, False]) +@pytest.mark.parametrize("json_output", [True, False]) +def test_report_completeness_and_same_event_coverage( + attribution_db: Path, + metric: str, + event_id: int, + active: int, + limit: int, + include_static: bool, + json_output: bool, +) -> None: + """Below/equal/above cap preserve rows and flags, including special groups.""" + args = [ + "report", + "peak-memory", + str(attribution_db), + "--device", + "0", + "--metric", + metric, + "--limit", + str(limit), + "--include-static" if include_static else "--exclude-static", + ] + params = {"event_id": event_id, "include_static": include_static, "min_size": 0, "top_n": limit} + partial = limit >= 0 and event_id >= limit + dynamic_sizes = sorted([10, 20, 30][:event_id], reverse=True) + included = sum(dynamic_sizes if limit < 0 else dynamic_sizes[:limit]) + included += 150 if include_static else 0 + coverage = included * 100 / active + result = CliRunner().invoke(app, args + (["--json"] if json_output else [])) + assert result.exit_code == 0, result.output + if json_output: + payload = json.loads(result.stdout) + with SnapshotAnalyzer(attribution_db) as analyzer: + query = analyzer.execute_query( + "active_memory_callstack_at_event", params=params, device_id=0 + ) + assert payload["callstack_groups"] == query["rows"] + assert payload["has_more"] == query["has_more"] == partial + assert payload["truncated"] == query["truncated"] == partial + assert payload["total_is_exact"] == query["total_is_exact"] == (not partial) + assert payload["effective_params"] == params + assert payload["event_id"] == event_id + assert payload["included_bytes"] == included + assert payload["percent_denominator"] == "included_bytes" + assert payload["active_bytes_at_event"] == active + assert payload["coverage_percent"] == pytest.approx(coverage) + for row in payload["callstack_groups"]: + assert row["percent_of_active_blocks"] == pytest.approx( + round(row["size_bytes"] * 100 / included, 4) + ) + if include_static: + assert {row["category"] for row in payload["callstack_groups"]} == { + "static", + "preexisting_live_at_event", + "dynamic_live_at_event", + } + if limit < 0 or limit >= event_id: + missing = next( + row + for row in payload["callstack_groups"] + if row["callstack"] == "[missing callstack]" + ) + assert missing["category"] == "dynamic_live_at_event" + assert missing["requested_bytes"] is None + else: + assert f"Event ID: {event_id}" in result.stdout + status = ( + "partial / possibly incomplete" if partial else "complete for the effective filters" + ) + assert f"Attribution: {status}" in result.stdout + assert f"include_static={include_static}, min_size=0, top_n={limit}" in result.stdout + assert f"Percentage denominator: included_bytes={included} bytes" in result.stdout + assert f"Active coverage at event {event_id}: {coverage:.4f}%" in result.stdout + assert f"active={active} bytes" in result.stdout + assert ("Increase --limit" in result.stdout) == partial + + +@pytest.mark.parametrize("state", ["empty", "null", "zero"]) +@pytest.mark.parametrize("json_output", [True, False]) +def test_report_unknown_coverage(attribution_db: Path, state: str, json_output: bool) -> None: + with closing(sqlite3.connect(attribution_db)) as conn, conn: + if state == "empty": + conn.execute("DELETE FROM trace_entry_0") + else: + conn.execute("UPDATE trace_entry_0 SET active = ?", (None if state == "null" else 0,)) + conn.execute("UPDATE block_0 SET size = 0") + # Select reserved so a NULL active counter still has a selected event. + args = ["report", "peak-memory", str(attribution_db), "--metric", "reserved"] + result = CliRunner().invoke(app, args + (["--json"] if json_output else [])) + assert result.exit_code == 0, result.output + if json_output: + payload = json.loads(result.stdout) + assert payload["coverage_percent"] is None + assert payload["included_bytes"] == 0 + assert payload["active_bytes_at_event"] == (0 if state == "zero" else None) + assert payload["has_more"] is False + assert payload["truncated"] is False + assert payload["total_is_exact"] is True + if state == "empty": + assert payload["event_id"] is None + assert payload["callstack_groups"] == [] + else: + assert payload["event_id"] == 1 + assert all( + row["percent_of_active_blocks"] is None for row in payload["callstack_groups"] + ) + else: + assert "unknown (included=0 bytes" in result.stdout + assert "Percentage denominator: included_bytes=0 bytes" in result.stdout + if state == "empty": + assert "Attribution: unavailable (no peak event)" in result.stdout + assert "No active memory callstack groups found" in result.stdout