external_zblue/samples/userspace/syscall_perf
Benjamin Cabé bc001bf9dd doc: samples: Adopt code-sample-category across tree
This commit uses the new .. zephyr:code-sample-category directive to
categorize code samples across the tree.
Updates existing legacy references to manually defined targets to now
use :zephyr:code-sample-category: role instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-04-20 17:44:55 +08:00
..
src samples, tests, boards: Switch main return type from void to int 2026-04-20 16:20:05 +08:00
CMakeLists.txt
README.rst doc: samples: Adopt code-sample-category across tree 2026-04-20 17:44:55 +08:00
prj.conf samples: syscall_perf: Remove unused build option 2026-04-20 16:54:16 +08:00
sample.yaml hwmv2: Introduce Hardware model version 2 and convert devices 2026-04-20 17:04:04 +08:00

README.rst

.. zephyr:code-sample:: syscall_perf
   :name: Syscall performance

   Measure performance overhead of a system calls compared to direct function calls.

Syscall performances
====================

The goal of this sample application is to measure the performance loss when a
user thread has to go through a system call compared to a supervisor thread that
calls the function directly.


Overview
********

This application creates a supervisor and a user thread.
Then both threads call :c:func:`k_current_get()` which returns a reference to the
current thread. The user thread has to go through a system call.

Both threads are showing the number of core clock cycles and the number of
instructions executed while calling :c:func:`k_current_get()`.


Sample Output
*************

.. code-block:: console

    User thread:		   18012 cycles	     748 instructions
    Supervisor thread:	       7 cycles	       4 instructions
    User thread:		   20136 cycles	     748 instructions
    Supervisor thread:	       7 cycles	       4 instructions
    User thread:		   18014 cycles	     748 instructions
    Supervisor thread:	       7 cycles	       4 instructions