How to enable perf tools

Please provide the following info (check/uncheck the boxes after clicking “+ Create Topic”):
Software Version
[*] DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
[*] Linux
QNX
other

Hardware Platform
[*] NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.5.0.7774
other

Host Machine Version
[*] native Ubuntu 18.04
other

I want to use perf tool on AGX. But found following issue.

$ perf top
WARNING: perf not found for kernel 4.14.150-rt67

  You may need to install the following packages for this specific kernel:
    linux-tools-4.14.150-rt67-tegra
    linux-cloud-tools-4.14.150-rt67-tegra

  You may also want to install one of the following packages to keep up to date:
    linux-tools-tegra
    linux-cloud-tools-tegra

$ sudo apt-get install linux-tools-tegra
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-tools-tegra

$ gunzip -c /proc/config.gz | grep PERF
CONFIG_CGROUP_PERF=y
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
CONFIG_HAVE_PERF_REGS=y
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_HW_PERF_EVENTS=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CLS_U32_PERF is not set
# CONFIG_BCMDHD_CUSTOM_NET_PERF_TEGRA is not set
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_NTB_PERF=m
CONFIG_HARDLOCKUP_DETECTOR_PERF=y
# CONFIG_RCU_PERF_TEST is not set
CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y

/usr/src$ ls
tensorrt

Ref this topic, I need to download kernel headers file firstly. Where I can get 4.14.150-rt67 header file?

I have another try below, but still doesn’t work for me.

  1. scp ~/nvidia/nvidia_sdk/DRIVE_OS_5.2.0_SDK_Linux_OS_DDPX/DRIVEOS/drive-oss-src/kernel from PC to AGX target side.
  2. Do install perf again with make command. Still doesn’t work for me.
~/kernel/tools/perf$ sudo make
  BUILD:   Doing 'make -j7' parallel build
Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'

Auto-detecting system features:
...                         dwarf: [ OFF ]
...            dwarf_getlocations: [ OFF ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ OFF ]
...                        libelf: [ OFF ]
...                       libnuma: [ OFF ]
...        numa_num_possible_cpus: [ OFF ]
...                       libperl: [ on  ]
...                     libpython: [ OFF ]
...                      libslang: [ OFF ]
...                     libcrypto: [ OFF ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ OFF ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ OFF ]
...                           bpf: [ on  ]

Makefile.config:291: No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel
Makefile.config:399: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:472: Disabling post unwind, no support found.
Makefile.config:522: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
Makefile.config:533: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev
Makefile.config:548: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:562: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:619: No 'python-config' tool was found: disables Python support - please install python-devel/python-dev
Makefile.config:725: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
  GEN      perf-archive
  GEN      perf-with-kcore
  CC       util/header.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf
``

Dear @Peter_Pertril,
May I know what you want to measure in an application? Is nsight is not sufficient for your usecase?

I want to use perf top/list or related method to monitor my application hotpoint or bottleneck. Then we do more optimized as needed.
In other words, we want to do more application performance analyses with the help of perf tools.

Dear @Peter_Pertrili,
It seems the apt packages are not available for target. Could you check building from source on target? have you checked it?