awslabs / damo

DAMON user-space tool
https://damonitor.github.io/
GNU General Public License v2.0
148 stars 28 forks source link

perf record not working with "perf" #74

Closed DanielLee343 closed 10 months ago

DanielLee343 commented 10 months ago

Hi,

I just setup DAMON on a new server but somehow experienced this issue.

lyuze@wukong0:~/masim$ ./masim ./configs/zigzag.cfg &
lyuze@wukong0:~$ sudo damo record -o damon.data $(pidof masim)
perf record not working with "perf"

I see the damo python script is calling this:

subprocess.check_output(
                    [PERF, 'record', '-e', PERF_EVENT, '--', 'sleep', '0'],
                    stderr=subprocess.PIPE)

And when I try this command in shell:

lyuze@wukong0:~$ sudo perf record -e damon:damon_aggregated -- sleep 0
event syntax error: 'damon:damon_aggregated'
                     \___ unsupported tracepoint

libtraceevent is necessary for tracepoint support
Run 'perf list' for a list of valid events

 Usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event>   event selector. use 'perf list' to list available events

Although I have installed libtraceevent-dev and libtraceevent1 and damon:damon_aggregated is in my perf list:

lyuze@wukong0:~$ sudo perf list | grep damon
  damon:damon_aggregated                             [Tracepoint event]

Server environment:

lyuze@wukong0:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
lyuze@wukong0:~$ uname -r
6.2.0
lyuze@wukong0:~$ if grep CONFIG_DAMON /boot/config-$(uname -r); then echo "installed"; fi
CONFIG_DAMON=y
CONFIG_DAMON_VADDR=y
CONFIG_DAMON_PADDR=y
CONFIG_DAMON_SYSFS=y
CONFIG_DAMON_DBGFS=y
CONFIG_DAMON_RECLAIM=y
CONFIG_DAMON_LRU_SORT=y
installed
DanielLee343 commented 10 months ago

Fixed it. Turns out some missing dependencies for perf:

# install perf
sudo apt-get install -y linux-tools-common linux-tools-generic linux-tools-`uname -r`
# if not work, then
cd <linux-dir>/tools/perf
make
sudo cp perf /usr/bin

If still not working, note that perf requires ALL the following dependencies in order to be recognized from damo (make sure you install all), and do the above steps to build from source:

$ ldd /usr/lib/perf
linux-vdso.so.1 (0x00007fff5d7f6000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f99d10fa000)
libelf.so.1 => /lib/x86_64-linux-gnu/libelf.so.1 (0x00007f99d10dc000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f99d0600000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f99d10c0000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f99d1095000)
libnuma.so.1 => /lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f99d1086000)
libtraceevent.so.1 => /lib/x86_64-linux-gnu/libtraceevent.so.1 (0x00007f99d105f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f99d0200000)
/lib64/ld-linux-x86-64.so.2 (0x00007f99d11f0000)
sj-aws commented 10 months ago

Thank you for the update, Daniel!