summaryrefslogtreecommitdiff
path: root/internal/flamegraph
diff options
context:
space:
mode:
Diffstat (limited to 'internal/flamegraph')
-rw-r--r--internal/flamegraph/flamegraph.go9
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 {