1.. zephyr:code-sample:: syscall_perf 2 :name: Syscall performance 3 4 Measure performance overhead of a system calls compared to direct function calls. 5 6Syscall performances 7==================== 8 9The goal of this sample application is to measure the performance loss when a 10user thread has to go through a system call compared to a supervisor thread that 11calls the function directly. 12 13 14Overview 15******** 16 17This application creates a supervisor and a user thread. 18Then both threads call :c:func:`k_current_get()` which returns a reference to the 19current thread. The user thread has to go through a system call. 20 21Both threads are showing the number of core clock cycles and the number of 22instructions executed while calling :c:func:`k_current_get()`. 23 24 25Sample Output 26************* 27 28.. code-block:: console 29 30 User thread: 18012 cycles 748 instructions 31 Supervisor thread: 7 cycles 4 instructions 32 User thread: 20136 cycles 748 instructions 33 Supervisor thread: 7 cycles 4 instructions 34 User thread: 18014 cycles 748 instructions 35 Supervisor thread: 7 cycles 4 instructions 36