A place to start: https://software.intel.com/en-us/vtune-install-guide-linux

We will install only cli version of vtune, GUI version requires additional handling of X11 dependencies, gtk libs and glibc. For some reason installed didn’t find some of them in my system, although they were installed.

Below you will find interactive procedure, check here for the silent approach: https://software.intel.com/en-us/vtune-install-guide-linux-auto-install

Interactive install

  • Download source

Go here https://software.intel.com/en-us/VTUNE/CHOOSE-DOWNLOAD and follow a bunch of steps including authentication (you should register an account at https://software.intel.com)

  • After unpacking run ./install.sh. You can do it with user permissions, no need for root.

Agree with terms of use, make sure to choose writeable directory (since we are running installer as a regular user), remember (!) to remove tick for the gui component.

  • After required files have been installed, you’ll find vtune_profiler symlink in your install directory.

Sampling driver

By default vtune build required kernel modules for making use of event-based sampling. Why you might need it? Read here: https://software.intel.com/en-us/vtune-install-guide-linux-what-features-are-available-if-i-install-intel-vtune-profiler-as-a-non-root-or-non-administrator-user

If you decided to build it, follow me :)

  • Go to install_dir/vtune_profiler/sepdk/src. It should exist if installation of vtune passed successfully.

  • You can try running ./build-driver rightaway, though it didn’t work for me. I’ve got the following error:

In file included from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/smp.h:60,
                 from /opt/vtune/vtune_profiler_2020.0.0.605129/sepdk/src/vtsspp/config.h:38,
                 from /opt/vtune/vtune_profiler_2020.0.0.605129/sepdk/src/vtsspp/sched.c:28:
/opt/vtune/vtune_profiler_2020.0.0.605129/sepdk/src/vtsspp/sched.c: In function ‘vtss_sched_switch_to’:
./arch/x86/include/asm/processor.h:839:39: error: implicit declaration of function ‘task_stack_page’; did you mean ‘task_stack_vm_area’? [-Werror=implicit-function-declaration]
  839 |  unsigned long __ptr = (unsigned long)task_stack_page(task); \
      |                                       ^~~~~~~~~~~~~~~
./arch/x86/include/asm/processor.h:922:26: note: in expansion of macro ‘task_pt_regs’
  922 | #define KSTK_EIP(task)  (task_pt_regs(task)->ip)
      |                          ^~~~~~~~~~~~
/opt/vtune/vtune_profiler_2020.0.0.605129/sepdk/src/vtsspp/sched.c:148:22: note: in expansion of macro ‘KSTK_EIP’
  148 |                 ip = KSTK_EIP(task);
      |                      ^~~~~~~~
cc1: some warnings being treated as errors

Based on some random answer from github: https://github.com/diederikdehaas/rtl8812AU/issues/75#issuecomment-318832002 I discovered the following piece of code in install_dir/vtune_profiler/sepdk/src/vtsspp/sched.c:

#if 0 & LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
#include <linux/sched/task.h>
#include <linux/sched/task_stack.h>
#include <linux/sched/mm.h>
#include <linux/sched/signal.h>
#endif

As suggested in the thread, exactly these lines are required to fix the issue. For some reason intel developers commented this out. Let’s do the reverse job:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
#include <linux/sched/task.h>
#include <linux/sched/task_stack.h>
#include <linux/sched/mm.h>
#include <linux/sched/signal.h>
#endif

After applying this change, I managed to run ./build-driver without errors.

  • Drivers built. Now to use vtune you should do two things:

Load kernel-modules (as root now):

root# install_dir/vtune_profiler/sepdk/src/insmod-sep

Load env-vars for vtune and sep:

source install_dir/vtune_profiler/sep_vars.sh
source install_dir/vtune_profiler/vtune-vars.sh