diff options
| author | alex emery <[email protected]> | 2024-11-03 15:35:07 +0000 |
|---|---|---|
| committer | alex emery <[email protected]> | 2024-11-03 16:03:43 +0000 |
| commit | b28b124f1bc62a737bc4a11d575ff7638e65ee66 (patch) | |
| tree | 19f78fa1ff45f158798e1922fb74fc8809d7b7a2 /content/posts/2024-08-25-01.md | |
| parent | 508527f52de524a4fd174d386808e314b4138b11 (diff) | |
use obsidian symlink to posts
Diffstat (limited to 'content/posts/2024-08-25-01.md')
| -rw-r--r-- | content/posts/2024-08-25-01.md | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/content/posts/2024-08-25-01.md b/content/posts/2024-08-25-01.md deleted file mode 100644 index 8aee591..0000000 --- a/content/posts/2024-08-25-01.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Go Benchmarking" -tags: posts -toc: true ---- - -The benchmark cycle: -1. write a benchmark -2. run a benchmark -3. get a profile -4. optimise -5. run your tests -6. goto 2. - -# cpuprofile -```shell -go test -test=XXX -bench <regex> -cpuprofile <file> -``` - -# memprofile -```shell -go test -test=XXX -bench <regex> -memprofile <file> -benchmem -``` - -# pprof -[pprof usage](https://github.com/google/pprof/blob/main/doc/README.md) - -```shell -go pprof -http=:8080 profile.pb.gz -``` -will show a web UI for analysing the profile. - -## 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 - - right click "show source code" to view -- top: `localhost:8080/ui/top` - - shows top functions - - `flat`: profile samples in this function - - `cum`: (cumulative) profile samples in this function and its callees -- source: `localhost:8080/ui/source` - - each source line is annotated with the time spent in that source line - - the first number does not count time spent in functions called from the source line - - the second number does
\ No newline at end of file |
