@cryptotaxi247 / kubo / commits / 0f3cea6a8

debug-guide.md added memory statistics command

License: MIT Signed-off-by: Rob Deutsch <rdeutschob@gmail.com>

rob-deutsch committed Sep 29, 2018 at 16:45 UTC 0f3cea6a8e4112348c55d3dc49f5a389e2f13602
1 file changed +9 -2
docs/debug-guide.md
+9 -2
@@ -4,8 +4,9 @@ This is a document for helping debug go-ipfs. Please add to it if you can!
4
5 ### Table of Contents
6 - [Beginning](#beginning)
7 -- [Analysing the stack dump](#analysing-the-stack-dump)
7 +- [Analyzing the stack dump](#analyzing-the-stack-dump)
8 - [Analyzing the CPU Profile](#analyzing-the-cpu-profile)
9 +- [Analyzing vars and memory statistics](#analyzing-vars-and-memory-statistics)
10 - [Other](#other)
11
12 ### Beginning
@@ -20,6 +21,8 @@ profiling information.
21 - `curl localhost:5001/debug/pprof/profile > ipfs.cpuprof`
22 - heap trace dump
23 - `curl localhost:5001/debug/pprof/heap > ipfs.heap`
24 +- memory statistics (in json, see "memstats" object)
25 + - `curl localhost:5001/debug/vars > ipfs.vars`
26 - system information
27 - `ipfs diag sys > ipfs.sysinfo`
28
@@ -28,7 +31,7 @@ Bundle all that up and include a copy of the ipfs binary that you are running
31
32 You can investigate yourself if you feel intrepid:
33
31 -### Analysing the stack dump
34 +### Analyzing the stack dump
35
36 The first thing to look for is hung goroutines -- any goroutine thats been stuck
37 for over a minute will note that in the trace. It looks something like:
@@ -84,6 +87,10 @@ about `go tool pprof`. My go-to method of analyzing these is to run the `web`
87 command, which generates an SVG dotgraph and opens it in your browser. This is
88 the quickest way to easily point out where the hot spots in the code are.
89
90 +### Analyzing vars and memory statistics
91 +
92 +The output is JSON formatted and includes badger store statistics, the command line run, and the output from Go's [runtime.ReadMemStats](https://golang.org/pkg/runtime/#ReadMemStats). The [MemStats](https://golang.org/pkg/runtime/#MemStats) has useful information about memory allocation and garbage collection.
93 +
94 ### Other
95
96 If you have any questions, or want us to analyze some weird go-ipfs behaviour,