delve/_fixtures/goroutineLabels.go
Dmitry Neverov ca3fe88899 proc,service: expose goroutine pprof labels in api
Labels can help in identifying a particular goroutine during debugging.

Fixes #1763
2020-01-21 09:08:36 -08:00

23 lines
307 B
Go

package main
import (
"context"
"runtime"
"runtime/pprof"
)
func main() {
ctx := context.Background()
labels := pprof.Labels("k1", "v1", "k2", "v2")
runtime.Breakpoint()
pprof.Do(ctx, labels, f)
}
var dummy int
func f(ctx context.Context) {
a := dummy
runtime.Breakpoint()
dummy++
dummy = a
}