Last active
April 17, 2024 21:31
-
-
Save nidhi-ag/0eed632509a79ebc75218a8485a1ebe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install perf in docker container | |
### ubuntu 18.4 | |
### kernel 4.14.173-137.229.amzn2.x86_64 | |
docker exec -it {containerid} sh | |
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.173.tar.xz && tar -xf ./linux-4.14.173.tar.xz && cd linux-4.14.173/tools/perf/ && apt -y install flex bison && make -C . && make install | |
./perf | |
./perf list | |
./perf bench mem all | |
Note: Run docker in privileged mode | |
References | |
https://medium.com/@geekidea_81313/running-perf-in-docker-kubernetes-7eb878afcd42 | |
https://stackoverflow.com/questions/44745987/use-perf-inside-a-docker-container-without-privileged | |
## cpu profiling of a process | |
git clone https://github.com/brendangregg/FlameGraph | |
cd FlameGraph | |
/linux-4.14.173/tools/perf/perf record -F 99 -p {pid} -g -- sleep 60 | |
/linux-4.14.173/tools/perf/perf script | ./stackcollapse-perf.pl > out.perf-folded | |
./flamegraph.pl out.perf-folded > perf-kernel.svg |
THANKS!!!
Thanks
Or simply install it as any other package, adding in the DockerFile:
apt-get install -y linux-perf linux-base
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!