|
|
@ -27,6 +27,7 @@ import ( |
|
|
|
"os/user" |
|
|
|
"os/user" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
"runtime" |
|
|
|
"runtime" |
|
|
|
|
|
|
|
"runtime/debug" |
|
|
|
"runtime/pprof" |
|
|
|
"runtime/pprof" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
@ -69,6 +70,20 @@ func (*HandlerT) BacktraceAt(location string) error { |
|
|
|
return glog.GetTraceLocation().Set(location) |
|
|
|
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
|
|
|
|
// CpuProfile turns on CPU profiling for nsec seconds and writes
|
|
|
|
// profile data to file.
|
|
|
|
// profile data to file.
|
|
|
|
func (h *HandlerT) CpuProfile(file string, nsec uint) error { |
|
|
|
func (h *HandlerT) CpuProfile(file string, nsec uint) error { |
|
|
|