Skip to content

collect: add call tree text and JSON for all profiles#115

Merged
AlexsanderHamir merged 10 commits into
mainfrom
feat/call-trees-collection
Jul 6, 2026
Merged

collect: add call tree text and JSON for all profiles#115
AlexsanderHamir merged 10 commits into
mainfrom
feat/call-trees-collection

Conversation

@AlexsanderHamir

@AlexsanderHamir AlexsanderHamir commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Collect pprof -tree\ text reports for every processed profile under .prof//call_trees//.txt, using the same flags as hotspots (-cum -nodefraction=0 -edgefraction=0).
  • Export structured call-graph JSON (all nodes with flat/cum/% plus caller→callee edges) to .prof//call_trees//.json\ via the in-process parser.
  • Wire both artifacts into auto and manual collection paths.

Profile artifact refactor (follow-up commits on this branch)

  • Unified pprof text runner — \PprofTextReportArgs\ +
    unPprofReport\ replace duplicate -top\ / -tree\ helpers.
  • Parse-once bundle — \parser.ProfileBundle\ aggregates flat/cum and call graph in one pipeline pass; JSON emission reads from the bundle instead of re-parsing.
  • Artifact catalog — \ProfileArtifact\ registry with \Required\ / \BestEffort\ policies drives \processOneProfile\ and \�mitProfileArtifacts; PNG remains best-effort with warn-and-continue.

Test plan

  • \go test ./... -count=1\
  • \golangci-lint\ clean
  • \�ngine/collect\ tests assert catalog order, required failures, and best-effort PNG skip
  • \parser\ tests cover \BundleFromPath, synthetic stack edges, and fixture JSON round-trip
  • Manual spot-check: \prof auto\ on a benchmark and confirm .prof//\ artifact tree unchanged (hotspots, call_trees, call_graphs)

AlexsanderHamir and others added 10 commits July 6, 2026 15:58
Introduce CallTreesDir and TagLayout helpers for tree text and JSON artifacts under .prof/<tag>/call_trees/.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mirror hotspot flags (-cum -nodefraction=0 -edgefraction=0) for -tree output.

Co-authored-by: Cursor <cursoragent@cursor.com>
Aggregate all functions and caller-callee edges from pprof samples with flat/cum metrics.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire pprof -tree and in-process call graph JSON into auto and manual collection paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Describe tree text and JSON artifacts in collect and workspace guides.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract processOneProfile to reduce cognitive complexity, fix goimports alignment, and eliminate err shadowing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract a single argv builder for -top and -tree so collect uses one code path for human-readable pprof output.

Co-authored-by: Cursor <cursoragent@cursor.com>
Parse each profile once into flat/cum plus call-graph data; CallGraphFromPath delegates to BundleFromPath.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace duplicate pprof text helpers and imperative emit steps with runPprofReport, parse-once ProfileBundle, and a Required/BestEffort artifact catalog shared by auto and manual collection.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove in-process call-graph JSON export, ProfileBundle, and related parser code. Call trees are collected as text via go tool pprof -tree only.

Co-authored-by: Cursor <cursoragent@cursor.com>
@AlexsanderHamir
AlexsanderHamir merged commit b5684ff into main Jul 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant