summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-03-14 20:26:31 +0200
committerPaul Buetow <paul@buetow.org>2025-03-14 20:26:31 +0200
commit092ba747e516620054852f012dbc7d00031683dd (patch)
treec3e2d57c371fc1e15c3fb5e7eef76c57661430ea
parenta4948d9fb1aded11e3111f3730b4e3e4e5bd540c (diff)
add sycall on bottom
-rw-r--r--Makefile14
-rw-r--r--internal/flamegraph/flamegraph.go19
2 files changed, 25 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 26c74a7..668a877 100644
--- a/Makefile
+++ b/Makefile
@@ -35,9 +35,15 @@ world: clean generate all
.PHONY: flames
flames:
- perl ~/git/FlameGraph/flamegraph.pl ior-by-count-flamegraph.collapsed \
+ perl ~/git/FlameGraph/flamegraph.pl ior-by-path-count-flamegraph.collapsed \
--title "I/O Syscall Count" --nametype Path --hash \
- > ior-by-count-flamegraph.svg
- perl ~/git/FlameGraph/flamegraph.pl ior-by-duration-flamegraph.collapsed \
+ > 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-duration-flamegraph.svg
+ > 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; \
diff --git a/internal/flamegraph/flamegraph.go b/internal/flamegraph/flamegraph.go
index 85b6a5c..cf1284e 100644
--- a/internal/flamegraph/flamegraph.go
+++ b/internal/flamegraph/flamegraph.go
@@ -71,15 +71,21 @@ func (f Flamegraph) Add(ev *event.Pair) {
}
func (f Flamegraph) dump() {
- f.dumpBy("ior-by-count-flamegraph.collapsed", func(cnt counter) uint64 {
+ f.dumpBy("ior-by-path-count-flamegraph.collapsed", true, func(cnt counter) uint64 {
return cnt.count
})
- f.dumpBy("ior-by-duration-flamegraph.collapsed", func(cnt counter) uint64 {
+ f.dumpBy("ior-by-path-duration-flamegraph.collapsed", true, func(cnt counter) uint64 {
+ return cnt.duration
+ })
+ f.dumpBy("ior-by-syscall-count-flamegraph.collapsed", false, func(cnt counter) uint64 {
+ return cnt.count
+ })
+ f.dumpBy("ior-by-syscall-duration-flamegraph.collapsed", false, func(cnt counter) uint64 {
return cnt.duration
})
}
-func (f Flamegraph) dumpBy(outfile string, by func(counter) uint64) {
+func (f Flamegraph) dumpBy(outfile string, syscallAtTop bool, by func(counter) uint64) {
fmt.Println("Dumping", outfile)
file, err := os.Create(outfile)
if err != nil {
@@ -99,7 +105,12 @@ func (f Flamegraph) dumpBy(outfile string, by func(counter) uint64) {
}
for traceId, cnt := range value {
- _, err := fmt.Fprintf(file, "%s;syscall`%s %v\n", sb.String(), traceId.Name(), by(cnt))
+ var err error
+ if syscallAtTop {
+ _, err = fmt.Fprintf(file, "%s;syscall`%s %v\n", sb.String(), traceId.Name(), by(cnt))
+ } else {
+ _, err = fmt.Fprintf(file, "syscall`%s;%s %v\n", traceId.Name(), sb.String(), by(cnt))
+ }
if err != nil {
panic(err)
}