Commit 51a21838 authored by Keith Rarick's avatar Keith Rarick Committed by Russ Cox

runtime: add Goroutines

R=rsc
CC=golang-dev
https://golang.org/cl/3508041
parent 63544c47
...@@ -26,6 +26,9 @@ func GOMAXPROCS(n int) int ...@@ -26,6 +26,9 @@ func GOMAXPROCS(n int) int
// Cgocalls returns the number of cgo calls made by the current process. // Cgocalls returns the number of cgo calls made by the current process.
func Cgocalls() int64 func Cgocalls() int64
// Goroutines returns the number of goroutines that currently exist.
func Goroutines() int32
type MemStatsType struct { type MemStatsType struct {
// General statistics. // General statistics.
// Not locked during update; approximate. // Not locked during update; approximate.
......
...@@ -1192,3 +1192,10 @@ runtime·mid(uint32 ret) ...@@ -1192,3 +1192,10 @@ runtime·mid(uint32 ret)
ret = m->id; ret = m->id;
FLUSH(&ret); FLUSH(&ret);
} }
void
runtime·Goroutines(int32 ret)
{
ret = runtime·sched.gcount;
FLUSH(&ret);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment