Standard library / runtime/trace
trace.Region
Handle for a traced interval on one goroutine. Regions must be properly nested. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type Region struct {}Working Example
Example Snippetgo
package main
import ( "bytes" "context" "fmt" "runtime/trace")
func main() { var b bytes.Buffer if err := trace.Start(&b); err != nil { panic(err) } var r *trace.Region = trace.StartRegion(context.Background(), "parse") r.End() trace.Stop() fmt.Println(b.Len() > 0)}