diff options
author | Felix Lange <fjl@twurst.com> | 2016-02-20 22:42:22 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-04-13 18:08:07 +0800 |
commit | bea56d84e53c255febaad5cb26d30122d87d02d9 (patch) | |
tree | 37f57b694f59b2de2541e69a96ae80edfaa4e263 /internal | |
parent | bcd8aeefdd40174a7fb1dd320b00f090d8986f11 (diff) | |
download | dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar.gz dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar.bz2 dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar.lz dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar.xz dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.tar.zst dexon-bea56d84e53c255febaad5cb26d30122d87d02d9.zip |
internal/debug: add memStats and gcStats to API
Diffstat (limited to 'internal')
-rw-r--r-- | internal/debug/api.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/debug/api.go b/internal/debug/api.go index 83857eb2e..2cb264040 100644 --- a/internal/debug/api.go +++ b/internal/debug/api.go @@ -27,6 +27,7 @@ import ( "os/user" "path/filepath" "runtime" + "runtime/debug" "runtime/pprof" "strings" "sync" @@ -69,6 +70,20 @@ func (*HandlerT) BacktraceAt(location string) error { return glog.GetTraceLocation().Set(location) } +// MemStats returns detailed runtime memory statistics. +func (*HandlerT) MemStats() *runtime.MemStats { + s := new(runtime.MemStats) + runtime.ReadMemStats(s) + return s +} + +// GcStats returns GC statistics. +func (*HandlerT) GcStats() *debug.GCStats { + s := new(debug.GCStats) + debug.ReadGCStats(s) + return s +} + // CpuProfile turns on CPU profiling for nsec seconds and writes // profile data to file. func (h *HandlerT) CpuProfile(file string, nsec uint) error { |