2

Can anyone give me better technical answer on difference between profiling using perf at kernel vs user vs system space?

The perf documentation has details here, but I am not sure if I collect data at user space, will that be more insightful than collecting at kernel space?

enter image description here

To give more details, what will be major difference between following perf stat command.

System Wide

perf stat -a --per-core -e instructions <application>

User Space

perf stat -a --per-core -e instructions:u <application>

Kernel Space

perf stat -a --per-core -e instructions:k <application>

User and Kernel Space

perf stat -a --per-core -e instructions:uk <application>
Chetan Arvind Patil
  • 854
  • 1
  • 11
  • 31
  • 1
    [Differences between User and Kernel modes](https://stackoverflow.com/questions/1311402/differences-between-user-and-kernel-modes) is a good place to start. – myaut Oct 04 '17 at 20:57
  • 1
    For root user (required to use `-a` system-wide) events by default are kernel+user space. User space will trigger events when user-space program code (some C/C++/Java/etc programs and libraries) is running and will not count when kernel code works. Kernel-space will profile only execution of OS kernel code (when Linux kernel works on requests from user code or when it does some periodic/hardware/driver jobs). – osgx Oct 04 '17 at 23:14

0 Answers0