Go 官方进程诊断工具 gops 详解
参考链接:http://dockone.io/article/10681
查看内存使用情况: $ gops memstats 3739 alloc: 1.15MB (1205272 bytes) total-alloc: 1.15MB (1205272 bytes) sys: 69.45MB (72827136 bytes) lookups: 0 mallocs: 644 frees: 12 heap-alloc: 1.15MB (1205272 bytes) heap-sys: 63.66MB (66748416 bytes) heap-idle: 62.05MB (65060864 bytes) heap-in-use: 1.61MB (1687552 bytes) heap-released: 62.02MB (65028096 bytes) heap-objects: 632 ...
查看运行时信息: $ gops stats 3739 goroutines: 2 OS threads: 8 GOMAXPROCS: 4 num CPU: 4
查看指定进程信息: $ gops <pid> parent PID: 3725 threads: 7 memory usage: 0.042% cpu usage: 0.003% username: eddycjy cmd+args: /var/folders/jm/pk20jr_s74x49kqmyt87n2800000gn/T/go-build943691423/b001/exe/main elapsed time: 10:56 local/remote: 127.0.0.1:59369 <-> :0 (LISTEN) local/remote: *:6060 <-> :0 (LISTEN)