diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-14 22:58:10 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-14 22:58:10 +0200 |
| commit | 3edde70ef17d23a3f2fcb0fac11a50e8810ab943 (patch) | |
| tree | 677a865082872147ebf75426f2192d1ac2ff2f6a /internal/flamegraph | |
| parent | 1827045051c46db54662e1b4b710504da438f1d1 (diff) | |
fixed a bug with the filepath
Diffstat (limited to 'internal/flamegraph')
| -rw-r--r-- | internal/flamegraph/flamegraph.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/flamegraph/flamegraph.go b/internal/flamegraph/flamegraph.go index c543320..9e15889 100644 --- a/internal/flamegraph/flamegraph.go +++ b/internal/flamegraph/flamegraph.go @@ -18,6 +18,8 @@ type counter struct { // TODO: Profile for CPU usage. If too slow, can fan out into multiple maps and // then merge at the end the maps. type Flamegraph struct { + // TODO: Keep al lthe individual files at the leaf in a map as well. + // And when dumped, only dump the N "highest" and summarize the other ones. collapsed map[string]map[types.TraceId]counter inCh chan *event.Pair Done chan struct{} @@ -36,6 +38,7 @@ func (f Flamegraph) Start(ctx context.Context) { for { select { case ev := <-f.inCh: + // filePath := path.Dir(ev.File.Name()) filePath := ev.File.Name() pathMap, ok := f.collapsed[filePath] if !ok { @@ -50,6 +53,7 @@ func (f Flamegraph) Start(ctx context.Context) { f.collapsed[filePath] = pathMap ev.RecyclePrev() + default: select { case <-ctx.Done(): @@ -101,6 +105,7 @@ func (f Flamegraph) dumpBy(outfile string, syscallAtTop bool, by func(counter) u sb.WriteString("/") } sb.WriteString(part) + fmt.Println("DEBUG part", i, part, len(part)) } for traceId, cnt := range value { |
