mirror of
https://github.com/google/gops.git
synced 2024-11-24 08:22:25 +02:00
doc: reorganize the README
This commit is contained in:
parent
671bd43984
commit
35b841e24e
75
README.md
75
README.md
@ -42,9 +42,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Diagnostics manual
|
### Manual
|
||||||
|
|
||||||
#### 0. listing all processes
|
#### Listing all processes
|
||||||
|
|
||||||
To print all go processes, run `gops` without arguments:
|
To print all go processes, run `gops` without arguments:
|
||||||
|
|
||||||
@ -58,15 +58,31 @@ $ gops
|
|||||||
|
|
||||||
Note that processes running the agent are marked with `*` next to the PID (e.g. `4132*`).
|
Note that processes running the agent are marked with `*` next to the PID (e.g. `4132*`).
|
||||||
|
|
||||||
#### 1. stack
|
#### $ gops stack \<pid\>
|
||||||
|
|
||||||
In order to print the current stack trace from a target program, run the following command:
|
In order to print the current stack trace from a target program, run the following command:
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ gops stack <pid>
|
$ gops stack <pid>
|
||||||
|
gops stack 85709
|
||||||
|
goroutine 8 [running]:
|
||||||
|
runtime/pprof.writeGoroutineStacks(0x13c7bc0, 0xc42000e008, 0xc420ec8520, 0xc420ec8520)
|
||||||
|
/Users/jbd/go/src/runtime/pprof/pprof.go:603 +0x79
|
||||||
|
runtime/pprof.writeGoroutine(0x13c7bc0, 0xc42000e008, 0x2, 0xc428f1c048, 0xc420ec8608)
|
||||||
|
/Users/jbd/go/src/runtime/pprof/pprof.go:592 +0x44
|
||||||
|
runtime/pprof.(*Profile).WriteTo(0x13eeda0, 0x13c7bc0, 0xc42000e008, 0x2, 0xc42000e008, 0x0)
|
||||||
|
/Users/jbd/go/src/runtime/pprof/pprof.go:302 +0x3b5
|
||||||
|
github.com/google/gops/agent.handle(0x13cd560, 0xc42000e008, 0xc420186000, 0x1, 0x1, 0x0, 0x0)
|
||||||
|
/Users/jbd/src/github.com/google/gops/agent/agent.go:150 +0x1b3
|
||||||
|
github.com/google/gops/agent.listen()
|
||||||
|
/Users/jbd/src/github.com/google/gops/agent/agent.go:113 +0x2b2
|
||||||
|
created by github.com/google/gops/agent.Listen
|
||||||
|
/Users/jbd/src/github.com/google/gops/agent/agent.go:94 +0x480
|
||||||
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 2. memstats
|
#### $ gops memstats \<pid\>
|
||||||
|
|
||||||
To print the current memory stats, run the following command:
|
To print the current memory stats, run the following command:
|
||||||
|
|
||||||
@ -74,7 +90,30 @@ To print the current memory stats, run the following command:
|
|||||||
$ gops memstats <pid>
|
$ gops memstats <pid>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3. pprof
|
|
||||||
|
#### $ gops gc \<pid\>
|
||||||
|
|
||||||
|
If you want to force run garbage collection on the target program, run `gc`.
|
||||||
|
It will block until the GC is completed.
|
||||||
|
|
||||||
|
|
||||||
|
#### $ gops version \<pid\>
|
||||||
|
|
||||||
|
gops reports the Go version the target program is built with, if you run the following:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ gops version <pid>
|
||||||
|
devel +6a3c6c0 Sat Jan 14 05:57:07 2017 +0000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### $ gops stats \<pid\>
|
||||||
|
|
||||||
|
To print the runtime statistics such as number of goroutines and `GOMAXPROCS`.
|
||||||
|
|
||||||
|
#### Profiling
|
||||||
|
|
||||||
|
|
||||||
|
##### Pprof
|
||||||
|
|
||||||
gops supports CPU and heap pprof profiles. After reading either heap or CPU profile,
|
gops supports CPU and heap pprof profiles. After reading either heap or CPU profile,
|
||||||
it shells out to the `go tool pprof` and let you interatively examine the profiles.
|
it shells out to the `go tool pprof` and let you interatively examine the profiles.
|
||||||
@ -91,7 +130,7 @@ To enter the heap profile, run:
|
|||||||
$ gops pprof-heap <pid>
|
$ gops pprof-heap <pid>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4. trace
|
##### Go execution trace
|
||||||
|
|
||||||
gops allows you to start the runtime tracer for 5 seconds and examine the results.
|
gops allows you to start the runtime tracer for 5 seconds and examine the results.
|
||||||
|
|
||||||
@ -99,27 +138,3 @@ gops allows you to start the runtime tracer for 5 seconds and examine the result
|
|||||||
$ gops trace <pid>
|
$ gops trace <pid>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 5. gc
|
|
||||||
|
|
||||||
If you want to force run garbage collection on the target program, run the following command.
|
|
||||||
It will block until the GC is completed.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ gops gc <pid>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6. version
|
|
||||||
|
|
||||||
gops reports the Go version the target program is built with, if you run the following:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ gops version <pid>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 7. stats
|
|
||||||
|
|
||||||
To print the runtime statistics such as number of goroutines and `GOMAXPROCS`, run the following:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ gops stats <pid>
|
|
||||||
```
|
|
||||||
|
Loading…
Reference in New Issue
Block a user