Source File
annotation.go
Belonging Package
runtime/trace
package trace
import (
_
)
type traceContextKey struct{}
func ( context.Context, string) ( context.Context, *Task) {
:= fromContext().id
:= newID()
userTaskCreate(, , )
:= &Task{id: }
return context.WithValue(, traceContextKey{}, ),
type Task struct {
}
func ( *Task) () {
userTaskEnd(.id)
}
var lastTaskID uint64 = 0 // task id issued last time
:= fromContext().id
userLog(, , fmt.Sprintf(, ...))
}
}
const (
regionStartCode = uint64(0)
regionEndCode = uint64(1)
)
:= fromContext().id
userRegion(, regionStartCode, )
defer userRegion(, regionEndCode, )
()
}
func ( context.Context, string) *Region {
if !IsEnabled() {
return noopRegion
}
:= fromContext().id
userRegion(, regionStartCode, )
return &Region{, }
}
type Region struct {
id uint64
regionType string
}
var noopRegion = &Region{}
func ( *Region) () {
if == noopRegion {
return
}
userRegion(.id, regionEndCode, .regionType)
}
func ( uint64)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |