0

My goal is to use perf to run performance tests on some Docker images. By default, the images I'm using don't come with perf. As such, I tried

apt-get update
apt-get install linux-tools-generic

to get perf, but I got

E: Unable to locate package linux-tools-generic

I asked on SO, and was told that my sources.list might not be set up properly, and was also sent here because my confusion better pertains to SF.

Any advice on how I can get/run perf inside various Docker containers?

Karan
  • 1
  • 3

2 Answers2

0

centos:

[alexus@wcmisdlin02 ~]$ docker run -it centos
[root@ae6c1eb43a15 /]# yum --assumeyes --quiet install perf
warning: /var/cache/yum/x86_64/7/base/packages/numactl-libs-2.0.9-7.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for numactl-libs-2.0.9-7.el7.x86_64.rpm is not installed
Public key for perf-3.10.0-862.3.3.el7.x86_64.rpm is not installed
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-5.1804.el7.centos.2.x86_64 (@Updates)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@ae6c1eb43a15 /]# perf --version
perf version 3.10.0-862.3.3.el7.x86_64.debug
[root@ae6c1eb43a15 /]# 

ubuntu:

[alexus@wcmisdlin02 ~]$ docker run -it ubuntu bash
root@98214d8d539f:/#
root@98214d8d539f:/# apt-get -qq update && apt-get -qq install linux-tools-generic         
.....
root@98214d8d539f:/# perf
alexus
  • 13,112
  • 32
  • 117
  • 174
0
apt-get -qq update && apt-get -qq install linux-tools-generic

didn't work, I got a different solution to work for me. I'd done

apt-get update
apt-get install linux-tools

Which I realized gave me perf_4.9. A softlink later, perf now works inside a docker container. It's not the kernel specific one, but it works for what I need (so far).

Karan
  • 1
  • 3