File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
27
27
"os/user"
28
28
"path/filepath"
29
29
"runtime"
30
+ "runtime/debug"
30
31
"runtime/pprof"
31
32
"strings"
32
33
"sync"
@@ -69,6 +70,20 @@ func (*HandlerT) BacktraceAt(location string) error {
69
70
return glog .GetTraceLocation ().Set (location )
70
71
}
71
72
73
+ // MemStats returns detailed runtime memory statistics.
74
+ func (* HandlerT ) MemStats () * runtime.MemStats {
75
+ s := new (runtime.MemStats )
76
+ runtime .ReadMemStats (s )
77
+ return s
78
+ }
79
+
80
+ // GcStats returns GC statistics.
81
+ func (* HandlerT ) GcStats () * debug.GCStats {
82
+ s := new (debug.GCStats )
83
+ debug .ReadGCStats (s )
84
+ return s
85
+ }
86
+
72
87
// CpuProfile turns on CPU profiling for nsec seconds and writes
73
88
// profile data to file.
74
89
func (h * HandlerT ) CpuProfile (file string , nsec uint ) error {
Original file line number Diff line number Diff line change @@ -327,6 +327,16 @@ web3._extend({
327
327
params: 0,
328
328
outputFormatter: console.log
329
329
}),
330
+ new web3._extend.Method({
331
+ name: 'memStats',
332
+ call: 'debug_memStats',
333
+ params: 0,
334
+ }),
335
+ new web3._extend.Method({
336
+ name: 'gcStats',
337
+ call: 'debug_gcStats',
338
+ params: 0,
339
+ }),
330
340
new web3._extend.Method({
331
341
name: 'cpuProfile',
332
342
call: 'debug_cpuProfile',
You can’t perform that action at this time.
0 commit comments