install-ubuntu 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. #!/usr/bin/env bash
  3. #
  4. # Copyright Materialize, Inc. and contributors. All rights reserved.
  5. #
  6. # Use of this software is governed by the Business Source License
  7. # included in the LICENSE file at the root of this repository.
  8. #
  9. # As of the Change Date specified in that file, in accordance with
  10. # the Business Source License, use of this software will be governed
  11. # by the Apache License, Version 2.0.
  12. # Script to build and install a version of perf that can symbolize rust
  13. # binaries in a performant fashion
  14. echo "Installing perf build-time dependencies"
  15. sudo apt install -y libbfd-dev libiberty-dev
  16. echo "Installing build dependencies to enable majority of perf features"
  17. sudo apt install -y bison \
  18. flex \
  19. libbabeltrace-ctf-dev \
  20. libcap-dev \
  21. libdw-dev \
  22. libelf-dev \
  23. libgtk2.0-dev \
  24. liblzma-dev \
  25. libnuma-dev \
  26. libslang2-dev \
  27. libunwind-dev \
  28. libzstd-dev \
  29. python-dev \
  30. systemtap-sdt-dev
  31. # TODO: Accept user's local copy of the linux source tree as input
  32. # or check for something like "${HOME}/src/linux"
  33. tmpdir=$(mktemp -d)
  34. cd "${tmpdir}" || exit 1
  35. echo "Installing linux source code"
  36. git clone https://github.com/torvalds/linux --depth 1
  37. cd linux/tools/perf || exit 1
  38. make
  39. if [[ -d "${HOME}/bin" ]]; then
  40. echo "Installing perf into ${HOME}/bin"
  41. cp perf "${HOME}/bin"
  42. fi
  43. echo "Giving all users access to run all perf events"
  44. sudo sh -c 'echo kernel.perf_event_paranoid=-1 > /etc/sysctl.d/60-mtrlz-enable-perf.conf'
  45. echo "You will need to reboot your system before perf will work"