MCPcopy Index your code
hub / github.com/bigwhite/functrace

github.com/bigwhite/functrace @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
42 symbols 111 edges 10 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

functrace

Quick Start

Install gen

$go get github.com/bigwhite/functrace/cmd/gen

And make sure the gen executable file is configured as part of the PATH env variable.

Generate trace entry for your packages

See the demo case: https://github.com/bigwhite/functrace/tree/main/examples/gen-demo

Add trace in batches

You can use the scripts/batch_add_trace.sh to add trace in batches for all go source files in some repo.

for example:

let's add trace in batches for github.com/panjf2000/gnet, the steps is below:

  • git clone https://github.com/panjf2000/gnet.git
  • cd gnet
  • execute the following command:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/bigwhite/functrace/main/scripts/batch_add_trace.sh)"

If the access to github.com is very slow in your area, then you can copy scripts/batch_add_trace.sh of functrace to gnet dir and execute bash batch_add_trace.sh.

The command will output:

[gen -w ./ringbuffer/ring_buffer_test.go]
add trace for ./ringbuffer/ring_buffer_test.go ok
[gen -w ./ringbuffer/ring_buffer.go]
add trace for ./ringbuffer/ring_buffer.go ok
... ...
[gen -w ./internal/netpoll/queue/queue.go]
no trace added for ./internal/netpoll/queue/queue.go
[gen -w ./gnet.go]
add trace for ./gnet.go ok
[gen -w ./acceptor_windows.go]
add trace for ./acceptor_windows.go ok

After debugging, you can use 'git checkout .' to recover the origin status of your local workspace.

Core symbols most depended-on inside this repo

Trace
called by 16
trace_nop.go
printTrace
called by 2
trace.go
Rewrite
called by 2
pkg/generator/rewrite.go
D
called by 2
pkg/generator/testdata/with_import_no_trace.go
usage
called by 2
cmd/gen/main.go
D
called by 2
examples/gen-demo/main.go
getGID
called by 1
trace.go
hasFuncDecl
called by 1
pkg/generator/rewrite.go

Shape

Function 40
Method 1
Struct 1

Languages

Go100%

Modules by API surface

examples/gen-demo/main.go8 symbols
pkg/generator/testdata/with_import_no_trace.go7 symbols
pkg/generator/testdata/with_import_with_trace.go5 symbols
pkg/generator/testdata/no_import.go5 symbols
example_test.go5 symbols
pkg/generator/rewrite.go4 symbols
trace.go3 symbols
cmd/gen/main.go3 symbols
trace_nop.go1 symbols
pkg/generator/rewrite_test.go1 symbols

For agents

$ claude mcp add functrace \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact