Some users have requested the ability to create a monitoring sessionwith perfmon2 from iside the kernel using a kernel thread. Perfmon2leverages a lot of kernel mechanisms which are not easy to use forinside the kernel: e.g. file descriptor, signals, system calls.

We have sort of duplicated the user level interface for kernel-levelusage. This new is interface is called KAPI. It does notuse certain abstractions, such as file descriptors. It bypassesthe front-end system calls because there is no need to copyarguments back and forth. It uses a completion queue insteadof a file-descriptor based message queue. Furthermore, the sampling buffer is directly accessible to the caller withouthaving to remap with mmap.

The current implementation is limited to creating system-widecontext ONLY.