summaryrefslogtreecommitdiffstats
path: root/libgo/go/runtime/debug.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/debug.go')
-rw-r--r--libgo/go/runtime/debug.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/libgo/go/runtime/debug.go b/libgo/go/runtime/debug.go
index b5f6571faa8..803ea4921c1 100644
--- a/libgo/go/runtime/debug.go
+++ b/libgo/go/runtime/debug.go
@@ -4,6 +4,8 @@
package runtime
+import "unsafe"
+
// Breakpoint() executes a breakpoint trap.
func Breakpoint()
@@ -26,6 +28,9 @@ func GOMAXPROCS(n int) int
// Cgocalls returns the number of cgo calls made by the current process.
func Cgocalls() int64
+// Goroutines returns the number of goroutines that currently exist.
+func Goroutines() int32
+
type MemStatsType struct {
// General statistics.
// Not locked during update; approximate.
@@ -34,6 +39,7 @@ type MemStatsType struct {
Sys uint64 // bytes obtained from system (should be sum of XxxSys below)
Lookups uint64 // number of pointer lookups
Mallocs uint64 // number of mallocs
+ Frees uint64 // number of frees
// Main allocation heap statistics.
HeapAlloc uint64 // bytes allocated and still in use
@@ -55,11 +61,12 @@ type MemStatsType struct {
BuckHashSys uint64 // profiling bucket hash table
// Garbage collector statistics.
- NextGC uint64
- PauseNs uint64
- NumGC uint32
- EnableGC bool
- DebugGC bool
+ NextGC uint64
+ PauseTotalNs uint64
+ PauseNs [256]uint64 // most recent GC pause times
+ NumGC uint32
+ EnableGC bool
+ DebugGC bool
// Per-size allocation statistics.
// Not locked during update; approximate.
@@ -70,6 +77,15 @@ type MemStatsType struct {
}
}
+var Sizeof_C_MStats int // filled in by malloc.goc
+
+func init() {
+ if Sizeof_C_MStats != unsafe.Sizeof(MemStats) {
+ println(Sizeof_C_MStats, unsafe.Sizeof(MemStats))
+ panic("MStats vs MemStatsType size mismatch")
+ }
+}
+
// MemStats holds statistics about the memory system.
// The statistics are only approximate, as they are not interlocked on update.
var MemStats MemStatsType
OpenPOWER on IntegriCloud