Closed hitzhangjie closed 1 year ago
$ sudo gofuncgraph --uprobe-wildcards 'main.main' ./gofunc_issue_2 'main.main'
found 3 uprobes, large number of uprobes (>1000) need long time for attaching and detaching, continue? [Y/n]
y
INFO[0002] start tracing
17 19:33:08.6581 main.main() { runtime.main+519 ?:?
17 19:33:09.6582 001.0001 } main.main+39 /home/gray/src/github.com/jschwinger233/proving-ground/gofunc_issue_2/main.go:7
^CINFO[0030] start detaching
Steps:
sudo gofuncgraph --uprobe-wildcards 'main.main' ./main 'main.main'
./main
Probably you thought gofuncgraph
would execute the command automatically, it actually merely traces the binary, and you'll have to run the command manually.
Sorry for the misunderstanding, I've always been too lazy to work out an up-to-date and user-friendly documentation.
BTW your tech blog helped me before, thanks a lot for those high-quality articles regarding ELF and debugger. :+1:
To be clear, the execution order is not required: in this case we have to run gofuncgraph
ahead of ./main
, otherwise we'll miss the invocation of main.main
function.
For another scenario, for instance, if we'd like to trace grpc-related APIs inside a running daemon, just run gofuncgraph
to attach the binary, then we can collect information from running process without disruption.
Thanks very much. It works.
I'm learning how to use ebpf and cilium. gofuncgraph is not only a very nice tool but also a good learning material. 👍
I have a golang program:
then build
go build -o main main.go
then run:
After 1 second, there's nothing output, I have to ctrl+c to terminate. I want to see the timecost duration execution of main.main. Please help.