diff options
Diffstat (limited to 'src/pkg/runtime/extern.go')
-rw-r--r-- | src/pkg/runtime/extern.go | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go index 20f234253..527e9cdf8 100644 --- a/src/pkg/runtime/extern.go +++ b/src/pkg/runtime/extern.go @@ -21,11 +21,20 @@ is GOGC=100. Setting GOGC=off disables the garbage collector entirely. The runtime/debug package's SetGCPercent function allows changing this percentage at run time. See http://golang.org/pkg/runtime/debug/#SetGCPercent. -The GOGCTRACE variable controls debug output from the garbage collector. -Setting GOGCTRACE=1 causes the garbage collector to emit a single line to standard -error at each collection, summarizing the amount of memory collected and the -length of the pause. Setting GOGCTRACE=2 emits the same summary but also -repeats each collection. +The GODEBUG variable controls debug output from the runtime. GODEBUG value is +a comma-separated list of name=val pairs. Supported names are: + + gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard + error at each collection, summarizing the amount of memory collected and the + length of the pause. Setting gctrace=2 emits the same summary but also + repeats each collection. + + schedtrace: setting schedtrace=X causes the scheduler to emit a single line to standard + error every X milliseconds, summarizing the scheduler state. + + scheddetail: setting schedtrace=X and scheddetail=1 causes the scheduler to emit + detailed multiline info every X milliseconds, describing state of the scheduler, + processors, threads and goroutines. The GOMAXPROCS variable limits the number of operating system threads that can execute user-level Go code simultaneously. There is no limit to the number of threads @@ -77,17 +86,8 @@ func Caller(skip int) (pc uintptr, file string, line int, ok bool) // It returns the number of entries written to pc. func Callers(skip int, pc []uintptr) int -type Func struct { // Keep in sync with runtime.h:struct Func - name string - typ string // go type string - src string // src file name - pcln []byte // pc/ln tab for this func - entry uintptr // entry pc - pc0 uintptr // starting pc, ln for table - ln0 int32 - frame int32 // stack frame size - args int32 // in/out args size - locals int32 // locals size +type Func struct { + opaque struct{} // unexported field to disallow conversions } // FuncForPC returns a *Func describing the function that contains the @@ -95,10 +95,14 @@ type Func struct { // Keep in sync with runtime.h:struct Func func FuncForPC(pc uintptr) *Func // Name returns the name of the function. -func (f *Func) Name() string { return f.name } +func (f *Func) Name() string { + return funcname_go(f) +} // Entry returns the entry address of the function. -func (f *Func) Entry() uintptr { return f.entry } +func (f *Func) Entry() uintptr { + return funcentry_go(f) +} // FileLine returns the file name and line number of the // source code corresponding to the program counter pc. @@ -110,9 +114,8 @@ func (f *Func) FileLine(pc uintptr) (file string, line int) { // implemented in symtab.c func funcline_go(*Func, uintptr) (string, int) - -// mid returns the current OS thread (m) id. -func mid() uint32 +func funcname_go(*Func) string +func funcentry_go(*Func) uintptr // SetFinalizer sets the finalizer associated with x to f. // When the garbage collector finds an unreachable block @@ -127,8 +130,9 @@ func mid() uint32 // The argument x must be a pointer to an object allocated by // calling new or by taking the address of a composite literal. // The argument f must be a function that takes a single argument -// of x's type and can have arbitrary ignored return values. -// If either of these is not true, SetFinalizer aborts the program. +// to which x's type can be assigned, and can have arbitrary ignored return +// values. If either of these is not true, SetFinalizer aborts the +// program. // // Finalizers are run in dependency order: if A points at B, both have // finalizers, and they are otherwise unreachable, only the finalizer |