Skip to content

Commit

Permalink
Add hidden --ready-file
Browse files Browse the repository at this point in the history
The --ready-file is created when all kprobes are attached. This is going
to be used to indicate readiness in the upcoming CI tests.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
  • Loading branch information
brb committed Nov 28, 2022
1 parent 0a62618 commit 0a23f88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/pwru/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type Flags struct {
PerCPUBuffer int
KMods []string
AllKMods bool

ReadyFile string
}

func (f *Flags) SetFlags() {
Expand All @@ -63,6 +65,9 @@ func (f *Flags) SetFlags() {
flag.IntVar(&f.PerCPUBuffer, "per-cpu-buffer", os.Getpagesize(), "per CPU buffer in bytes")

flag.StringVar(&f.OutputFile, "output-file", "", "write traces to file")

flag.StringVar(&f.ReadyFile, "ready-file", "", "create file after all BPF progs are attached")
flag.Lookup("ready-file").Hidden = true
}

type Tuple struct {
Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ func main() {

log.Println("Listening for events..")

if flags.ReadyFile != "" {
file, err := os.Create(flags.ReadyFile)
if err != nil {
log.Fatalf("Failed to create ready file: %s", err)
}
file.Close()
}

output, err := pwru.NewOutput(&flags, printSkbMap, printStackMap, addr2name)
if err != nil {
log.Fatalf("Failed to create outputer: %s", err)
Expand Down

0 comments on commit 0a23f88

Please sign in to comment.