package
0.0.0-20250227122322-59689edd5517
Repository: https://github.com/ardanlabs/gotraining.git
Documentation: pkg.go.dev
# README
Blocking Profiling
Testing and Tracing allows us to see blocking profiles.
Running a Test Based Blocking Profile
We can get blocking profiles by running a test.
Generate a block profile from running the test.
$ go test -blockprofile block.out
Run the pprof tool to view the blocking profile.
$ go tool pprof block.out
Review the TestLatency function.
$ list TestLatency
Running a Trace
Once you have a test established you can use the -trace trace.out option with the go test tool.
Generate a trace from running the test.
$ go test -trace trace.out
Run the trace tool to review the trace.
$ go tool trace trace.out
Links
No Extra links at this time.
Code Review
Blocking Trace (Go Playground)
All material is licensed under the Apache License Version 2.0, January 2004.
# Functions
TestLatencies provides a test to profile and trace channel latencies with a little data science sprinkled in.
TestLatency runs a single stream so we can look at blocking profiles for different buffer sizes.