zephyr/samples/userspace/syscall_perf
Filip Kokosinski 07e4ba4240 soc/sifive: differentiate between FE310-G000 and FE310-G002
This commit reflects a difference between FE310-G000 and FE310-G002 SoCs,
since only the latter supports PMP. The result of that is the split of the
HiFive1 board into two separate targets, since the HWMv2 right now assumes
that board revisions share the same SoC.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-06-02 17:37:32 +02:00
..
src
CMakeLists.txt
prj.conf
README.rst
sample.yaml soc/sifive: differentiate between FE310-G000 and FE310-G002 2025-06-02 17:37:32 +02:00

.. 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