← 返回命令列表

Linux command

gops 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List Go processes

gops

Show process details

gops [pid]

Dump stack trace

gops stack [pid]

Memory statistics

gops memstats [pid]

CPU profile

gops pprof-cpu [pid]

说明

gops lists and diagnoses Go processes running on the system. It identifies Go programs and provides debugging commands including stack traces, memory statistics, and CPU/heap profiling. For full diagnostic capabilities, the gops agent must be imported in target programs. Basic process identification works without the agent.

参数

stack _PID_
Print stack trace.
memstats _PID_
Show memory stats.
pprof-cpu _PID_
CPU profile.
pprof-heap _PID_
Heap profile.
gc _PID_
Trigger garbage collection.
--help
Display help information.

FAQ

What is the gops command used for?

gops lists and diagnoses Go processes running on the system. It identifies Go programs and provides debugging commands including stack traces, memory statistics, and CPU/heap profiling. For full diagnostic capabilities, the gops agent must be imported in target programs. Basic process identification works without the agent.

How do I run a basic gops example?

Run `gops` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does stack _PID_ do in gops?

Print stack trace.