Commit Graph

6 Commits

Author SHA1 Message Date
Cory Benfield 6719917e49 Add bpftrace support to stackdiff (#3329)
Motivation:

I had need of it, so I did it.

Modifications:

bpftrace output parses now

Result:

Better support
2025-08-01 09:45:59 +00:00
George Barnett 086c93ba19 Add stackdiff merging (#3290)
Motivation:

When you diff two sets of alloc stacks there are often natural pairings
which aren't exact matches (e.g. the compiler inlined something in one
but not the other). These are tedious to pair up manually, we can make
that easier.

Modifications:

- Add a 'merge' which allows you to interactively pair up stacks across
the two different sets by using the levenshtein distance between them.
- After interactive merging is complete any remaining alloc stacks.

Result:

Easier to diff stacks
2025-07-08 16:06:55 +00:00
George Barnett 4d7097406f Add stackdiff dump (#3289)
Motivation:

Sometimes it's helpful to view the alloc stacks from a program.

Modifications:

- Add a 'dump' subcommand to stackdiff allowing you to dump the stack
diff from heaptrack/dtrace/bpftrace
- You can also filter the stacks so that only certain stacks are
included

Result:

Can dump filtered alloc stacks to stdout
2025-07-08 13:37:25 +00:00
George Barnett 7ea505e5bf Add dtrace parsing (#3288)
Motivation:

We often debug allocations on macOS, so being able to parse the output
from malloc-aggregation.d is valuable.

Modifications:

- Add a dtrace parser to stackdiff

Result:

Can diff outputs from dtrace
2025-07-08 11:18:42 +01:00
George Barnett 67df59a0fa Add diffing to the stackdiff tool (#3287)
Motivation:

When debugging allocs its helpful to get a diff between two programs.

Modification:

- Adds a 'diff' subcommand which is roughly equivalent to the existing
'stackdiff-dtrace.py' script.

Result:

Alloc stacks can be diffed
2025-07-07 15:43:46 +00:00
George Barnett e84b2ce05a Add internals for stackdiff tool (#3286)
Motivation:

Our alloc regression workflows are somewhat disparate: on macOS we have
dtrace and a script to diff two ouputs. On Linux we have heaptrack and
bpftrace but no way to analyze their outputs.

Diffing output from these tools can be quite tedious if the stacks vary
even a little (because the compiler decided to not inline a function,
for example).

Most of the tedium in this workflow is from pairing up equivalent stacks
across the two inputs. We can make this easier to do by ranking
suggestions based on how similar they are and letting the user decide
whether to accept the match or not.

Modifications:

- Add a subpackage with some internals for parsing heaptrack,
aggregating stacks, and measuring the similarity between them
- The CLI took is currently a no-op, it'll be added in subsequent PRs

Result:

Easier to diagnose alloc regressions
2025-07-07 14:04:55 +00:00