diff options
| -rw-r--r-- | Makefile | 15 | ||||
| -rw-r--r-- | internal/flamegraph/flamegraph.go | 9 |
2 files changed, 18 insertions, 6 deletions
@@ -36,6 +36,21 @@ world: clean generate all .PHONY: flames flames: + perl ~/git/FlameGraph/flamegraph.pl ior-by-path-count-flamegraph.collapsed \ + --title "I/O Syscall Count" --nametype Path --hash \ + > ior-by-path-count-flamegraph.svg; \ + perl ~/git/FlameGraph/flamegraph.pl ior-by-path-duration-flamegraph.collapsed \ + --title "I/O Syscall Durations" --nametype Path --hash --countname Nanoseconds \ + > ior-by-path-duration-flamegraph.svg; \ + perl ~/git/FlameGraph/flamegraph.pl ior-by-syscall-count-flamegraph.collapsed \ + --title "I/O Syscall Count" --nametype Path --hash \ + > ior-by-syscall-count-flamegraph.svg; \ + perl ~/git/FlameGraph/flamegraph.pl ior-by-syscall-duration-flamegraph.collapsed \ + --title "I/O Syscall Durations" --nametype Path --hash --countname Nanoseconds \ + > ior-by-syscall-duration-flamegraph.svg; \ + +.PHONY: inferno +inferno: inferno-flamegraph < ior-by-path-count-flamegraph.collapsed \ --title "I/O Syscall Count" --nametype Path --hash \ > ior-by-path-count-flamegraph.svg; \ 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 { |
