From 9747eaa84f3cbec2267317fd98cda991c427f190 Mon Sep 17 00:00:00 2001 From: a73x Date: Sun, 25 Aug 2024 15:14:42 +0100 Subject: post 3 --- posts/001.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'posts/001.md') diff --git a/posts/001.md b/posts/001.md index 9942c2f..71ece5b 100644 --- a/posts/001.md +++ b/posts/001.md @@ -1,26 +1,25 @@ --- title: "Go Benchmarking" --- -## Benchmarking 1. write a benchmark 2. run a benchmark 3. get a profile 4. optimise 5. run your tests 6. goto 2. -### cpuprofile +## cpuprofile `go test -test=XXX -bench -cpuprofile ` -### memprofile +## memprofile `go test -test=XXX -bench -memprofile -benchmem` -### pprof +## pprof [pprof usage](https://github.com/google/pprof/blob/main/doc/README.md) `go pprof -http=:8080 profile.pb.gz` will show a web UI for analysing the profile. -#### views: +### views: - flame graph: `localhost:8080/ui/flamegraph` - shows percentage breakdown of how much resource each "call" made. - clicking a box will make it "100%" allowing for deep diving -- cgit v1.2.3