build(deps): bump github.com/spf13/cobra from 1.8.1 to 1.9.1
Bumps github.com/spf13/cobra from 1.8.1 to 1.9.1.
updated-dependencies:
- dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-minor …
Signed-off-by: dependabot[bot] support@github.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
gops
gops is a command to list and diagnose Go processes currently running on your system.
Installation
To install the latest version of gops:
or
To install a specific gops version, for example v0.3.19:
Diagnostics
For processes that start the diagnostics agent, gops can report additional information such as the current stack trace, Go version, memory stats, etc.
In order to start the diagnostics agent, see the hello example.
Otherwise, you could set
GOPS_CONFIG_DIRenvironment variables to assign your config dir. Default, gops will use the current user’s home directory(AppData on windows).Manual
It is possible to use gops tool both in local and remote mode.
Local mode requires that you start the target binary as the same user that runs gops binary. To use gops in a remote mode you need to know target’s agent address.
In Local mode use process’s PID as a target; in Remote mode target is a
host:portcombination.Listing all processes running locally
To print all go processes, run
gopswithout arguments:The output displays:
Note that processes running the agent are marked with
*next to the PID (e.g.4132*).$ gops <pid> [duration]
To report more information about a process, run
gopsfollowed by a PID:If an optional duration is specified in the format as expected by
time.ParseDuration, the CPU usage for the given time period is reported in addition:$ gops tree
To display a process tree with all the running Go processes, run the following command:
$ gops stack (<pid>|<addr>)
In order to print the current stack trace from a target program, run the following command:
$ gops memstats (<pid>|<addr>)
To print the current memory stats, run the following command:
$ gops gc (<pid>|<addr>)
If you want to force run garbage collection on the target program, run
gc. It will block until the GC is completed.$ gops setgc (<pid>|<addr>)
Sets the garbage collection target to a certain percentage. The following command sets it to 10%:
The following command turns off the garbage collector:
$ gops version (<pid>|<addr>)
gops reports the Go version the target program is built with, if you run the following:
$ gops stats (<pid>|<addr>)
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, it shells out to the
go tool pprofand let you interactively examine the profiles.To enter the CPU profile, run:
To enter the heap profile, run:
Execution trace
gops allows you to start the runtime tracer for 5 seconds and examine the results.