brendangregg / BPF-tools

Performance Tools using Linux eBPF
121 stars 32 forks source link

sudo python fileiostacks.py - Fails on compile error #3

Open moshelior opened 6 years ago

moshelior commented 6 years ago

You are missing a ';' in the line: BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE) in the file: https://github.com/brendangregg/BPF-tools/blob/master/old/2017-12-23/fileiostacks.py

If you try to run it you will get:

/virtual/main.c:16:36: error: expected ';' after top level declarator
BPF_STACK_TRACE(stack_traces, 2048)
                                   ^
                                   ;
1 error generated.
Traceback (most recent call last):
  File "fileiostacks.py", line 190, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 318, in __init__
    raise Exception("Failed to compile BPF text")
Exception: Failed to compile BPF text
zhangjaycee commented 6 years ago

The problem is just a semicolon missing, just add it to the line 111 of fileiostacks.py.( BPF_STACK_TRACE(stack_traces, 2048) --> BPF_STACK_TRACE(stack_traces, 2048); ) I have created a "pull request" to fix it just now.