diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-14 22:34:54 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-14 22:34:54 +0200 |
| commit | 1827045051c46db54662e1b4b710504da438f1d1 (patch) | |
| tree | 49043fc61d5f807507ebeb5f2be218b252f48621 /internal/flamegraph/flamegraph.go | |
| parent | 25f49e56b3d197390aa250cbbed1b18a2cb05942 (diff) | |
add file name
Diffstat (limited to 'internal/flamegraph/flamegraph.go')
| -rw-r--r-- | internal/flamegraph/flamegraph.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/internal/flamegraph/flamegraph.go b/internal/flamegraph/flamegraph.go index 9214f49..c543320 100644 --- a/internal/flamegraph/flamegraph.go +++ b/internal/flamegraph/flamegraph.go @@ -6,7 +6,6 @@ import ( "ior/internal/event" "ior/internal/generated/types" "os" - "path" "strings" "time" ) @@ -19,8 +18,6 @@ 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{} @@ -39,8 +36,8 @@ func (f Flamegraph) Start(ctx context.Context) { for { select { case ev := <-f.inCh: - pathname := path.Dir(ev.File.Name()) - pathMap, ok := f.collapsed[pathname] + filePath := ev.File.Name() + pathMap, ok := f.collapsed[filePath] if !ok { pathMap = make(map[types.TraceId]counter) } @@ -51,7 +48,7 @@ func (f Flamegraph) Start(ctx context.Context) { cnt.duration += ev.Duration pathMap[traceId] = cnt - f.collapsed[pathname] = pathMap + f.collapsed[filePath] = pathMap ev.RecyclePrev() default: select { |
