Is there an existing proposal for this?
Is your feature request related to a problem?
memray transform csv includes tid and thread_name columns in its output schema, but the transform command currently retrieves allocation records with threads merged.
When allocations with the same stack occur on multiple threads, the exported record can therefore contain tid = -1 and thread_name = "merged thread" instead of preserving the original thread identities.
This makes the CSV output difficult to use for per-thread analysis of multi-threaded Python or C++ workloads. It also differs from reporters such as flamegraph and table, which expose a --split-threads option.
Describe the solution you'd like
Add a --split-threads option to memray transform, initially at least for the CSV format.
When enabled for CSV output, the command would retrieve allocation records with merge_threads=False and allow TransformReporter to process those records. The existing tid and thread_name columns would then preserve the original thread information.
The default behavior would remain unchanged.
Would you prefer --split-threads to be:
- supported for CSV only, since its schema already represents thread identity; or
- supported across transform formats, with Speedscope potentially emitting separate profiles for each thread?
I would be happy to implement the narrower CSV-only version first, including CLI integration tests and reporter tests, if that is the preferred scope.
Alternatives you considered
Users can inspect per-thread information through the HTML reporters, but those reports do not provide a convenient machine-readable export for downstream analysis.
Is there an existing proposal for this?
Is your feature request related to a problem?
memray transform csvincludestidandthread_namecolumns in its output schema, but the transform command currently retrieves allocation records with threads merged.When allocations with the same stack occur on multiple threads, the exported record can therefore contain
tid = -1andthread_name = "merged thread"instead of preserving the original thread identities.This makes the CSV output difficult to use for per-thread analysis of multi-threaded Python or C++ workloads. It also differs from reporters such as flamegraph and table, which expose a
--split-threadsoption.Describe the solution you'd like
Add a
--split-threadsoption tomemray transform, initially at least for the CSV format.When enabled for CSV output, the command would retrieve allocation records with
merge_threads=Falseand allowTransformReporterto process those records. The existingtidandthread_namecolumns would then preserve the original thread information.The default behavior would remain unchanged.
Would you prefer
--split-threadsto be:I would be happy to implement the narrower CSV-only version first, including CLI integration tests and reporter tests, if that is the preferred scope.
Alternatives you considered
Users can inspect per-thread information through the HTML reporters, but those reports do not provide a convenient machine-readable export for downstream analysis.