Skip to content
/ gops Public
forked from google/gops

A tool to list and diagnose Go processes currently running on your system

License

Notifications You must be signed in to change notification settings

jmptrader/gops

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gops Build Status GoDoc

gops is a command to list and diagnose Go processes currently running on your system.

$ gops
983     uplink-soecks	(/usr/local/bin/uplink-soecks)
52697   gops	(/Users/jbd/bin/gops)
51130   gocode	(/Users/jbd/bin/gocode)

Installation

$ go get -u github.com/google/gops

Diagnostics

For processes that starts 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.

package main

import (
	"log"
	"time"

	"github.com/google/gops/agent"
)

func main() {
	if err := agent.Start(); err != nil {
		log.Fatal(err)
	}
	time.Sleep(time.Hour)
}

Please note that diagnostics features are only supported on Unix-like systems for now. We are planning to add Windows support in the near future.

Diagnostics manual

1. stack

In order to print the current stack trace from a target program, run the following command:

$ gops stack -p=<PID>

2. memstats

To print the current memory stats, run the following command:

$ gops memstats -p=<PID>

3. pprof

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.

To enter the CPU profile, run:

$ gops pprof-cpu -p=<PID>

To enter the heap profile, run:

$ gops pprof-mem -p=<PID>

4. 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.

$ gops gc -p=<PID>

5. version

gops reports the Go version the target program is built with, if you run the following:

$ gops version -p=<PID>

About

A tool to list and diagnose Go processes currently running on your system

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%