Skip to content

Commit

Permalink
rename to gofun / gofuncgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwinger233 committed Sep 5, 2022
1 parent 531cd21 commit fe83943
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 188 deletions.
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ before:
- go mod download

builds:
- id: ufuncgraph
- id: gofun
env:
- CGO_ENABLED=0
ldflags:
- -X github.com/jschwinger233/ufuncgraph/version.REVISION={{.Commit}}
- -X github.com/jschwinger233/ufuncgraph/version.VERSION={{.Env.VERSION}}
- -X github.com/jschwinger233/ufuncgraph/version.BUILTAT={{.Date}}
- -X github.com/jschwinger233/gofuncgraph/version.REVISION={{.Commit}}
- -X github.com/jschwinger233/gofuncgraph/version.VERSION={{.Env.VERSION}}
- -X github.com/jschwinger233/gofuncgraph/version.BUILTAT={{.Date}}
goos:
- linux
goarch:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ufuncgraph
# gofuncgraph

bpf(2)-based ftrace(1)-like function graph tracer for userspace processes.

Expand All @@ -17,7 +17,7 @@ Let's trace dockerd to see how it handles `docker stop`:
Type the command:

```bash
sudo ufuncgraph -d 1 ./bundles/binary-daemon/dockerd '!runtime.*' '!context.*' '!*vendor*' 'github.com/docker/docker/daemon.(*Daemon).containerStop(id=+0(+64(%rdi)):c256, name=+0(+200(%rdi)):c256, name_len=+208(%rdi):s32)'
sudo gofun -d 1 ./bundles/binary-daemon/dockerd '!runtime.*' '!context.*' '!*vendor*' 'github.com/docker/docker/daemon.(*Daemon).containerStop(id=+0(+64(%rdi)):c256, name=+0(+200(%rdi)):c256, name_len=+208(%rdi):s32)'
```

Explanations:
Expand All @@ -30,7 +30,7 @@ Explanations:

And will get the results:

![docker-stop-tracing](https://raw.githubusercontent.com/jschwinger233/ufuncgraph/master/assets/docker-stop-tracing.jpg)
![docker-stop-tracing](https://raw.githubusercontent.com/jschwinger233/gofuncgraph/master/assets/docker-stop-tracing.jpg)

# Use cases

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/jschwinger233/ufuncgraph
module github.com/jschwinger233/gofuncgraph

go 1.18

Expand Down
12 changes: 6 additions & 6 deletions internal/bpf/bpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"github.com/cilium/ebpf"
"github.com/cilium/ebpf/asm"
"github.com/cilium/ebpf/link"
"github.com/jschwinger233/ufuncgraph/internal/uprobe"
"github.com/jschwinger233/gofuncgraph/internal/uprobe"
dynamicstruct "github.com/ompluscator/dynamic-struct"
)

//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -no-strip -target native -type event Ufuncgraph ./ufuncgraph.c -- -I./headers
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -no-strip -target native -type event Gofuncgraph ./gofuncgraph.c -- -I./headers

const (
EventDataOffset int64 = 436
Expand Down Expand Up @@ -42,7 +42,7 @@ func (b *BPF) Load(uprobes []uprobe.Uprobe) (err error) {
AddField("EventQueue", &ebpf.Map{}, `ebpf:"event_queue"`).
AddField("Goids", &ebpf.Map{}, `ebpf:"goids"`)

spec, err := LoadUfuncgraph()
spec, err := LoadGofuncgraph()
if err != nil {
return err
}
Expand Down Expand Up @@ -146,14 +146,14 @@ func (b *BPF) Detach() {
}
}

func (b *BPF) PollEvents(ctx context.Context) chan UfuncgraphEvent {
ch := make(chan UfuncgraphEvent)
func (b *BPF) PollEvents(ctx context.Context) chan GofuncgraphEvent {
ch := make(chan GofuncgraphEvent)

queue := dynamicstruct.NewReader(b.objs).GetField("EventQueue").Interface().(*ebpf.Map)
go func() {
defer close(ch)
for {
event := UfuncgraphEvent{}
event := GofuncgraphEvent{}
select {
case <-ctx.Done():
return
Expand Down
File renamed without changes.
146 changes: 146 additions & 0 deletions internal/bpf/gofuncgraph_bpfel_x86.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
146 changes: 0 additions & 146 deletions internal/bpf/ufuncgraph_bpfel_x86.go

This file was deleted.

Loading

0 comments on commit fe83943

Please sign in to comment.