iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.57k stars 3.88k forks source link

use funclatency #3752

Open zxc199108 opened 2 years ago

zxc199108 commented 2 years ago

/virtual/main.c:43:9: error: no member named 'atomic_increment' in 'struct avg_table_t' avg.atomic_increment(lat, delta);


/virtual/main.c:44:9: error: no member named 'atomic_increment' in 'struct avg_table_t'
    avg.atomic_increment(cnt);
    ~~~ ^
/virtual/main.c:47:10: error: no member named 'atomic_increment' in 'struct dist_table_t'
    dist.atomic_increment(bpf_log2l(delta));
    ~~~~ ^
3 errors generated.
Traceback (most recent call last):
  File "funclatency.py", line 317, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 347, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
zxc199108 commented 2 years ago

python3 funclatency.py -p 7219 -u do_nanosleep

chenhengqi commented 2 years ago

You need to rebuild and install BCC.

Zarak-Shah-ji commented 2 years ago

How to rebuild BCC?

bahamasbahamas commented 1 year ago

After rebuilding and installing bcc, I received the same error when running funclatency.py in Pycharm.

/home/ubuntu/python35-setcap /home/ubuntu/bcc/tools/funclatency.py c:read 
/virtual/main.c:54:9: error: no member named 'atomic_increment' in 'struct avg_table_t'
    avg.atomic_increment(lat, delta);
    ~~~ ^
/virtual/main.c:55:9: error: no member named 'atomic_increment' in 'struct avg_table_t'
    avg.atomic_increment(cnt);
    ~~~ ^
/virtual/main.c:68:14: error: no member named 'atomic_increment' in 'struct dist_table_t'
        dist.atomic_increment(key);
        ~~~~ ^
3 errors generated.
Traceback (most recent call last):
  File "/home/ubuntu/bcc/tools/funclatency.py", line 345, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 364, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

I used these commands to run funclatency.py as root in Pycharm:

cp /usr/bin/python3 ~/python35-setcap sudo setcap 'cap_net_bind_service=+ep' ~/python35-setcap

If I start funclatency.py with sudo funclatency-bpfcc c: read from the terminal, it works.

Cycatz commented 1 year ago

For someone who encountered the same error: https://github.com/iovisor/bcc/issues/3911#issuecomment-1073399703 may help