Skip to content

Commit

Permalink
Use env to find bpftrace
Browse files Browse the repository at this point in the history
  • Loading branch information
krnowak committed Oct 19, 2018
1 parent 8ec651e commit 97fd5c4
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 25 deletions.
3 changes: 2 additions & 1 deletion docs/reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ iscsid is sleeping.
[...]
```

It can also be made executable to run stand-alone. Start by adding an interpreter line at the top (`#!`) with the path to your installed bpftrace (/usr/local/bin is the default):
It can also be made executable to run stand-alone. Start by adding an interpreter line at the top (`#!`) with either the path to your installed bpftrace (/usr/local/bin is the default) or the path to `env` (usually just `/usr/bin/env`) followed by `bpftrace` (so it will find bpftrace in your `$PATH`):

```
1 #!/usr/local/bin/bpftrace
1 #!/usr/bin/env bpftrace
2
3 tracepoint:syscalls:sys_enter_nanosleep
4 {
Expand Down
2 changes: 1 addition & 1 deletion tools/bashreadline.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* bashreadline Print entered bash commands from all running shells.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/biolatency.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* biolatency.bt Block I/O latency as a histogram.
* For Linux, uses bpftrace, eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/biosnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* biosnoop.bt Block I/O tracing tool, showing per I/O latency.
* For Linux, uses bpftrace, eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/bitesize.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* bitesize Show disk I/O size as a histogram.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/capable.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* capable Trace security capabilitiy checks (cap_capable()).
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/cpuwalk.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* cpuwalk Sample which CPUs are executing processes.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/dcsnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* dcsnoop Trace directory entry cache (dcache) lookups.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/execsnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* execsnoop.bt Trace new processes via exec() syscalls.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/gethostlatency.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* gethostlatency Trace getaddrinfo/gethostbyname[2] calls.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/killsnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* killsnoop Trace signals issued by the kill() syscall.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/loads.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* loads Prints load averages.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/mdflush.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* mdflush Trace md flush events.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/oomkill.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* oomkill Trace OOM killer.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/opensnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* opensnoop Trace open() syscalls.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/pidpersec.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* pidpersec Count new procesess (via fork).
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/runqlat.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* runqlat.bt CPU scheduler run queue latency as a histogram.
* For Linux, uses bpftrace, eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/runqlen.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* runqlen.bt CPU scheduler run queue length as a histogram.
* For Linux, uses bpftrace, eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/statsnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* statsnoop Trace stat() syscalls.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/syncsnoop.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* syncsnoop Trace sync() variety of syscalls.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/syscount.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* syscount.bt Count system callls.
* For Linux, uses bpftrace, eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/vfscount.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* vfscount Count VFS calls ("vfs_*").
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/vfsstat.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* vfsstat Count some VFS calls, with per-second summaries.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/writeback.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* writeback Trace file system writeback events with details.
* For Linux, uses bpftrace and eBPF.
Expand Down
2 changes: 1 addition & 1 deletion tools/xfsdist.bt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bpftrace
#!/usr/bin/env bpftrace
/*
* xfsdist Summarize XFS operation latency.
* For Linux, uses bpftrace and eBPF.
Expand Down

0 comments on commit 97fd5c4

Please sign in to comment.