diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-24 21:52:33 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-24 21:52:33 +0200 |
| commit | cf65e3f93e0565dda8f124b21b2c44b3a3ecaff5 (patch) | |
| tree | 09197d5afa42d7308d32d62c35dfe2fd5b9cde13 /internal/flamegraph | |
| parent | 84d523fd02cba38cfe90118975f345b989beaae1 (diff) | |
stability: remove unlink attach sleep and tighten svg/tui helpers
Diffstat (limited to 'internal/flamegraph')
| -rw-r--r-- | internal/flamegraph/nativesvg.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/flamegraph/nativesvg.go b/internal/flamegraph/nativesvg.go index 26fc1e8..831ffed 100644 --- a/internal/flamegraph/nativesvg.go +++ b/internal/flamegraph/nativesvg.go @@ -3,10 +3,9 @@ package flamegraph import ( "fmt" "io" + "iter" "os" "strings" - - "iter" ) type NativeSVG struct { @@ -54,19 +53,21 @@ func (n NativeSVG) WriteSVGFromFile(iorDataFile string) (outFile string, err err func (n NativeSVG) WriteSVGFromIter(records iter.Seq[IterRecord], w io.Writer) error { tr := newTrie() + var framesBuf []string for record := range records { - frames, err := n.recordFrames(record) + frames, err := n.recordFrames(record, framesBuf) if err != nil { return err } + framesBuf = frames tr.add(frames, record.Cnt.ValueByName(n.countField)) } tr.computeTotals() return WriteSVG(w, tr, n.config) } -func (n NativeSVG) recordFrames(record IterRecord) ([]string, error) { - var frames []string +func (n NativeSVG) recordFrames(record IterRecord, framesBuf []string) ([]string, error) { + frames := framesBuf[:0] for _, fieldName := range n.fields { value, err := record.StringByName(fieldName) if err != nil { |
