Git Product home page Git Product logo

Comments (1)

mrbuk avatar mrbuk commented on May 3, 2024 1

You might try to run the commands against a process that does not have the gops agent running.

This is not clear from the Github README.md but it is mentioned in the help:

> gops help
gops is a tool to list and diagnose Go processes.

Usage:
  gops <cmd> <pid|addr> ...
  gops <pid> # displays process info
  gops help  # displays this help message

Commands:
  stack      Prints the stack trace.
  gc         Runs the garbage collector and blocks until successful.
  setgc	     Sets the garbage collection target percentage.
  memstats   Prints the allocation and garbage collection stats.
  version    Prints the Go version used to build the program.
  stats      Prints runtime stats.
  trace      Runs the runtime tracer for 5 secs and launches "go tool trace".
  pprof-heap Reads the heap profile and launches "go tool pprof".
  pprof-cpu  Reads the CPU profile and launches "go tool pprof".

All commands require the agent running on the Go process.
"*" indicates the process is running the agent.

I am referring to the following part All commands require the agent running on the Go process.

When you run gops against a process that has the agent running you will see a local/remote field reported. That field contains the port gops connects against when running e.g. gops stack

> gops 64646                                                                                                                                                                       (1) 10:01:32 
parent PID:	64507
threads:	7
memory usage:	0.019%
cpu usage:	0.000%
username:	mbukowski
cmd+args:	/tmp/go-build1553357288/b001/exe/main
elapsed time:	04:16
local/remote:	127.0.0.1:35097 <-> 0.0.0.0:0 (LISTEN)

In contrast a process without the agent running doesn't report local/remote

> gops 39343                                                                                                                                                                           10:02:00 
parent PID:	15306
threads:	9
memory usage:	0.038%
cpu usage:	0.000%
username:	mbukowski
cmd+args:	starlark
elapsed time:	01-22:10:03

You can running gops against the pid of go run github.com/mrbuk/hello-gops and it should work.

from gops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.