tracing: swap: cleanup trace points and their location

Move tracing switched_in and switched_out to the architecture code and
remove duplications. This changes swap tracing for x86, xtensa.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-08-02 18:26:46 -04:00 committed by Carles Cufí
commit d1049dc258
3 changed files with 16 additions and 14 deletions

View file

@ -87,6 +87,13 @@ SECTION_FUNC(TEXT, arch_swap)
pop %edx
pop %eax
#endif
#if defined(CONFIG_TRACING)
pushl %eax
call sys_trace_thread_switched_out
popl %eax
#endif
/*
* Push all non-volatile registers onto the stack; do not copy
* any of these registers into the k_thread. Only the 'esp' register
@ -116,13 +123,6 @@ SECTION_FUNC(TEXT, arch_swap)
movl _kernel_offset_to_current(%edi), %edx
movl %esp, _thread_offset_to_esp(%edx)
#ifdef CONFIG_TRACING
/* Register the context switch */
push %edx
call sys_trace_thread_switched_in
pop %edx
#endif
movl _kernel_offset_to_ready_q_cache(%edi), %eax
/*
@ -363,6 +363,11 @@ CROHandlingDone:
pushl arch_timing_swap_start
popl arch_timing_value_swap_temp
time_read_not_needed:
#endif
#if defined(CONFIG_TRACING)
pushl %eax
call sys_trace_thread_switched_in
popl %eax
#endif
ret

View file

@ -227,6 +227,9 @@ xtensa_switch:
#ifdef CONFIG_EXECUTION_BENCHMARKING
call4 read_timer_end_of_swap
#endif
#ifdef CONFIG_TRACING
call4 sys_trace_thread_switched_in
#endif
j _restore_context
_switch_restore_pc:

View file

@ -97,7 +97,6 @@ static ALWAYS_INLINE unsigned int do_swap(unsigned int key,
#endif
if (new_thread != old_thread) {
sys_trace_thread_switched_out();
#ifdef CONFIG_TIMESLICING
z_reset_time_slice();
#endif
@ -113,6 +112,7 @@ static ALWAYS_INLINE unsigned int do_swap(unsigned int key,
z_smp_release_global_lock(new_thread);
}
#endif
sys_trace_thread_switched_out();
_current_cpu->current = new_thread;
wait_for_switch(new_thread);
arch_switch(new_thread->switch_handle,
@ -155,13 +155,7 @@ static inline int z_swap_irqlock(unsigned int key)
{
int ret;
z_check_stack_sentinel();
#ifndef CONFIG_ARM
sys_trace_thread_switched_out();
#endif
ret = arch_swap(key);
#ifndef CONFIG_ARM
sys_trace_thread_switched_in();
#endif
return ret;
}