Skip to content

Commit 38918a1

Browse files
committed
improves ebpf support on debian
1 parent e813976 commit 38918a1

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

pkg/agent/ebpfspy/session.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"os/exec"
99
"strconv"
10+
"strings"
1011
"sync"
1112
"syscall"
1213

@@ -31,7 +32,10 @@ type session struct {
3132

3233
const helpURL = "https://github.com/iovisor/bcc/blob/master/INSTALL.md"
3334

34-
var command = "/usr/share/bcc/tools/profile"
35+
var possibleCommandLocations = []string{
36+
"/usr/sbin/profile-bpfcc", // debian: https://github.com/pyroscope-io/pyroscope/issues/114
37+
"/usr/share/bcc/tools/profile",
38+
}
3539

3640
// TODO: make these configurable
3741
var commandArgs = []string{"-F", "100", "-f", "11"}
@@ -40,9 +44,19 @@ func newSession(pid int) *session {
4044
return &session{pid: pid}
4145
}
4246

47+
func findSuitableExecutable() (string, error) {
48+
for _, str := range possibleCommandLocations {
49+
if file.Exists(str) {
50+
return str, nil
51+
}
52+
}
53+
return "", fmt.Errorf("Could not find profile.py at %s. Visit %s for instructions on how to install it", strings.Join(possibleCommandLocations, ", "), helpURL)
54+
}
55+
4356
func (s *session) Start() error {
44-
if !file.Exists(command) {
45-
return fmt.Errorf("Could not find profile.py at '%s'. Visit %s for instructions on how to install it", command, helpURL)
57+
command, err := findSuitableExecutable()
58+
if err != nil {
59+
return err
4660
}
4761

4862
args := commandArgs

0 commit comments

Comments
 (0)