mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
build: move package sources from src/pkg to src
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
This commit is contained in:
parent
220a6de47e
commit
c007ce824d
2097 changed files with 0 additions and 0 deletions
56
src/runtime/debug.go
Normal file
56
src/runtime/debug.go
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Breakpoint executes a breakpoint trap.
|
||||
func Breakpoint()
|
||||
|
||||
// LockOSThread wires the calling goroutine to its current operating system thread.
|
||||
// Until the calling goroutine exits or calls UnlockOSThread, it will always
|
||||
// execute in that thread, and no other goroutine can.
|
||||
func LockOSThread()
|
||||
|
||||
// UnlockOSThread unwires the calling goroutine from its fixed operating system thread.
|
||||
// If the calling goroutine has not called LockOSThread, UnlockOSThread is a no-op.
|
||||
func UnlockOSThread()
|
||||
|
||||
// GOMAXPROCS sets the maximum number of CPUs that can be executing
|
||||
// simultaneously and returns the previous setting. If n < 1, it does not
|
||||
// change the current setting.
|
||||
// The number of logical CPUs on the local machine can be queried with NumCPU.
|
||||
// This call will go away when the scheduler improves.
|
||||
func GOMAXPROCS(n int) int {
|
||||
g := getg()
|
||||
g.m.scalararg[0] = uintptr(n)
|
||||
onM(gomaxprocs_m)
|
||||
n = int(g.m.scalararg[0])
|
||||
g.m.scalararg[0] = 0
|
||||
return n
|
||||
}
|
||||
|
||||
func gomaxprocs_m() // proc.c
|
||||
|
||||
// NumCPU returns the number of logical CPUs on the local machine.
|
||||
func NumCPU() int {
|
||||
return int(ncpu)
|
||||
}
|
||||
|
||||
// NumCgoCall returns the number of cgo calls made by the current process.
|
||||
func NumCgoCall() int64 {
|
||||
var n int64
|
||||
for mp := (*m)(atomicloadp(unsafe.Pointer(&allm))); mp != nil; mp = mp.alllink {
|
||||
n += int64(mp.ncgocall)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// NumGoroutine returns the number of goroutines that currently exist.
|
||||
func NumGoroutine() int {
|
||||
return int(gcount())
|
||||
}
|
||||
|
||||
func gcount() int32
|
||||
Loading…
Add table
Add a link
Reference in a new issue