Skip to content

Commit

Permalink
Add pprof
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed Dec 28, 2024
1 parent 38d38b9 commit 91d3595
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ proto-gen:
ghz-benchmark-id:
ghz --insecure --call proto.TigerBeetle.GetID -d {} -n 500000 --concurrency 20000 --connections=32 localhost:50051
ghz-benchmark-transfers:
ghz --insecure --call proto.TigerBeetle.CreateTransfers --data-file transfers.json -n 500000 --concurrency 20000 --connections=64 localhost:50051
ghz --insecure --call proto.TigerBeetle.CreateTransfers --data-file transfers.json -n 500000 --concurrency 20000 --connections=64 localhost:50051

pprof-build:
go build --tags pprof .
pprof-open:
go tool pprof -http=:8081 http://localhost:6060/debug/pprof/profile\?seconds\=5
16 changes: 16 additions & 0 deletions pprof.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//go:build pprof

package main

import (
"log/slog"
"net/http"
_ "net/http/pprof"
)

func init() {
slog.Info("pprof enabled")
go func() {
slog.Warn("pprof stopped", "err", http.ListenAndServe("localhost:6060", nil))
}()
}

0 comments on commit 91d3595

Please sign in to comment.