cleanup: include/: move tracing.h to debug/tracing.h

move tracing.h to debug/tracing.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-06-25 12:25:12 -04:00
commit 10291a0789
18 changed files with 159 additions and 144 deletions

View file

@ -23,7 +23,7 @@
#include <sw_isr_table.h> #include <sw_isr_table.h>
#include <irq.h> #include <irq.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <tracing.h> #include <debug/tracing.h>
extern void __reserved(void); extern void __reserved(void);

View file

@ -19,7 +19,7 @@
#include <sw_isr_table.h> #include <sw_isr_table.h>
#include <ksched.h> #include <ksched.h>
#include <kswap.h> #include <kswap.h>
#include <tracing.h> #include <debug/tracing.h>
void z_irq_spurious(void *unused) void z_irq_spurious(void *unused)
{ {

View file

@ -22,7 +22,7 @@
#include "posix_core.h" #include "posix_core.h"
#include "posix_soc_if.h" #include "posix_soc_if.h"
#include <tracing.h> #include <debug/tracing.h>
/** /**
* *

View file

@ -24,7 +24,7 @@
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <tracing.h> #include <debug/tracing.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#ifdef CONFIG_BOOT_TIME_MEASUREMENT #ifdef CONFIG_BOOT_TIME_MEASUREMENT

View file

@ -20,7 +20,7 @@
#include <misc/__assert.h> #include <misc/__assert.h>
#include <misc/printk.h> #include <misc/printk.h>
#include <irq.h> #include <irq.h>
#include <tracing.h> #include <debug/tracing.h>
#include <kswap.h> #include <kswap.h>
#include <arch/x86/segmentation.h> #include <arch/x86/segmentation.h>

View file

@ -5,7 +5,7 @@
*/ */
#include <kernel_internal.h> #include <kernel_internal.h>
#include <kernel_structs.h> #include <kernel_structs.h>
#include <tracing.h> #include <debug/tracing.h>
#include <ksched.h> #include <ksched.h>
#include <irq_offload.h> #include <irq_offload.h>
#include "xuk.h" #include "xuk.h"

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <tracing.h> #include <debug/tracing.h>
/* /*
* @brief Put the CPU in low-power mode * @brief Put the CPU in low-power mode

View file

@ -18,7 +18,7 @@
#include "board_soc.h" #include "board_soc.h"
#include "sw_isr_table.h" #include "sw_isr_table.h"
#include "soc.h" #include "soc.h"
#include <tracing.h> #include <debug/tracing.h>
typedef void (*normal_irq_f_ptr)(void *); typedef void (*normal_irq_f_ptr)(void *);
typedef int (*direct_irq_f_ptr)(void); typedef int (*direct_irq_f_ptr)(void);

View file

@ -17,7 +17,7 @@
#include "sw_isr_table.h" #include "sw_isr_table.h"
#include "soc.h" #include "soc.h"
#include "bs_tracing.h" #include "bs_tracing.h"
#include <tracing.h> #include <debug/tracing.h>
#include "bstests.h" #include "bstests.h"
static bool CPU_will_be_awaken_from_WFE; static bool CPU_will_be_awaken_from_WFE;

138
include/debug/tracing.h Normal file
View file

@ -0,0 +1,138 @@
/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DEBUG_TRACING_H_
#define ZEPHYR_INCLUDE_DEBUG_TRACING_H_
#include <kernel.h>
/* Below IDs are used with systemview, not final to the zephyr tracing API */
#define SYS_TRACE_ID_OFFSET (32u)
#define SYS_TRACE_ID_MUTEX_INIT (1u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_MUTEX_UNLOCK (2u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_MUTEX_LOCK (3u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_INIT (4u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_GIVE (5u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET)
#ifdef CONFIG_TRACING
void z_sys_trace_idle(void);
void z_sys_trace_isr_enter(void);
void z_sys_trace_isr_exit(void);
void z_sys_trace_isr_exit_to_scheduler(void);
void z_sys_trace_thread_switched_in(void);
void z_sys_trace_thread_switched_out(void);
#endif
#ifdef CONFIG_SEGGER_SYSTEMVIEW
#include "tracing_sysview.h"
#elif defined CONFIG_TRACING_CPU_STATS
#include "tracing_cpu_stats.h"
#elif defined CONFIG_TRACING_CTF
#include "tracing_ctf.h"
#else
/**
* @brief Called before a thread has been selected to run
*/
#define sys_trace_thread_switched_out()
/**
* @brief Called after a thread has been selected to run
*/
#define sys_trace_thread_switched_in()
/**
* @brief Called when setting priority of a thread
*/
#define sys_trace_thread_priority_set(thread)
/**
* @brief Called when a thread is being created
*/
#define sys_trace_thread_create(thread)
/**
* @brief Called when a thread is being aborted
*
*/
#define sys_trace_thread_abort(thread)
/**
* @brief Called when a thread is being suspended
* @param thread Thread structure
*/
#define sys_trace_thread_suspend(thread)
/**
* @brief Called when a thread is being resumed from suspension
* @param thread Thread structure
*/
#define sys_trace_thread_resume(thread)
/**
* @brief Called when a thread is ready to run
* @param thread Thread structure
*/
#define sys_trace_thread_ready(thread)
/**
* @brief Called when a thread is pending
* @param thread Thread structure
*/
#define sys_trace_thread_pend(thread)
/**
* @brief Provide information about specific thread
* @param thread Thread structure
*/
#define sys_trace_thread_info(thread)
/**
* @brief Called when entering an ISR
*/
#define sys_trace_isr_enter()
/**
* @brief Called when exiting an ISR
*/
#define sys_trace_isr_exit()
/**
* @brief Called when exiting an ISR and switching to scheduler
*/
#define sys_trace_isr_exit_to_scheduler()
/**
* @brief Can be called with any id signifying a new call
* @param id ID of the operation that was started
*/
#define sys_trace_void(id)
/**
* @brief Can be called with any id signifying ending a call
* @param id ID of the operation that was completed
*/
#define sys_trace_end_call(id)
#define z_sys_trace_idle()
#define z_sys_trace_isr_enter()
#define z_sys_trace_isr_exit()
#define z_sys_trace_isr_exit_to_scheduler()
#define z_sys_trace_thread_switched_in()
#define z_sys_trace_thread_switched_out()
#endif
#endif

View file

@ -5025,7 +5025,7 @@ __syscall int k_float_disable(struct k_thread *thread);
} }
#endif #endif
#include <tracing.h> #include <debug/tracing.h>
#include <syscalls/kernel.h> #include <syscalls/kernel.h>
#endif /* !_ASMLANGUAGE */ #endif /* !_ASMLANGUAGE */

View file

@ -1,138 +1,15 @@
/* /*
* Copyright (c) 2018 Intel Corporation * Copyright (c) 2019 Intel Corporation
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef ZEPHYR_INCLUDE_TRACING_H_ #ifndef ZEPHYR_INCLUDE_TRACING_H_
#define ZEPHYR_INCLUDE_TRACING_H_ #define ZEPHYR_INCLUDE_TRACING_H_
#include <kernel.h> #ifndef CONFIG_COMPAT_INCLUDES
#warning "This header file has moved, include <debug/tracing.h> instead."
/* Below IDs are used with systemview, not final to the zephyr tracing API */
#define SYS_TRACE_ID_OFFSET (32u)
#define SYS_TRACE_ID_MUTEX_INIT (1u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_MUTEX_UNLOCK (2u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_MUTEX_LOCK (3u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_INIT (4u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_GIVE (5u + SYS_TRACE_ID_OFFSET)
#define SYS_TRACE_ID_SEMA_TAKE (6u + SYS_TRACE_ID_OFFSET)
#ifdef CONFIG_TRACING
void z_sys_trace_idle(void);
void z_sys_trace_isr_enter(void);
void z_sys_trace_isr_exit(void);
void z_sys_trace_isr_exit_to_scheduler(void);
void z_sys_trace_thread_switched_in(void);
void z_sys_trace_thread_switched_out(void);
#endif #endif
#ifdef CONFIG_SEGGER_SYSTEMVIEW #include <debug/tracing.h>
#include "tracing_sysview.h"
#elif defined CONFIG_TRACING_CPU_STATS #endif /* ZEPHYR_INCLUDE_TRACING_H_ */
#include "tracing_cpu_stats.h"
#elif defined CONFIG_TRACING_CTF
#include "tracing_ctf.h"
#else
/**
* @brief Called before a thread has been selected to run
*/
#define sys_trace_thread_switched_out()
/**
* @brief Called after a thread has been selected to run
*/
#define sys_trace_thread_switched_in()
/**
* @brief Called when setting priority of a thread
*/
#define sys_trace_thread_priority_set(thread)
/**
* @brief Called when a thread is being created
*/
#define sys_trace_thread_create(thread)
/**
* @brief Called when a thread is being aborted
*
*/
#define sys_trace_thread_abort(thread)
/**
* @brief Called when a thread is being suspended
* @param thread Thread structure
*/
#define sys_trace_thread_suspend(thread)
/**
* @brief Called when a thread is being resumed from suspension
* @param thread Thread structure
*/
#define sys_trace_thread_resume(thread)
/**
* @brief Called when a thread is ready to run
* @param thread Thread structure
*/
#define sys_trace_thread_ready(thread)
/**
* @brief Called when a thread is pending
* @param thread Thread structure
*/
#define sys_trace_thread_pend(thread)
/**
* @brief Provide information about specific thread
* @param thread Thread structure
*/
#define sys_trace_thread_info(thread)
/**
* @brief Called when entering an ISR
*/
#define sys_trace_isr_enter()
/**
* @brief Called when exiting an ISR
*/
#define sys_trace_isr_exit()
/**
* @brief Called when exiting an ISR and switching to scheduler
*/
#define sys_trace_isr_exit_to_scheduler()
/**
* @brief Can be called with any id signifying a new call
* @param id ID of the operation that was started
*/
#define sys_trace_void(id)
/**
* @brief Can be called with any id signifying ending a call
* @param id ID of the operation that was completed
*/
#define sys_trace_end_call(id)
#define z_sys_trace_idle()
#define z_sys_trace_isr_enter()
#define z_sys_trace_isr_exit()
#define z_sys_trace_isr_exit_to_scheduler()
#define z_sys_trace_thread_switched_in()
#define z_sys_trace_thread_switched_out()
#endif
#endif

View file

@ -9,7 +9,7 @@
#include <kernel_structs.h> #include <kernel_structs.h>
#include <timeout_q.h> #include <timeout_q.h>
#include <tracing.h> #include <debug/tracing.h>
#include <stdbool.h> #include <stdbool.h>
BUILD_ASSERT(K_LOWEST_APPLICATION_THREAD_PRIO BUILD_ASSERT(K_LOWEST_APPLICATION_THREAD_PRIO

View file

@ -31,7 +31,7 @@
#include <kswap.h> #include <kswap.h>
#include <entropy.h> #include <entropy.h>
#include <logging/log_ctrl.h> #include <logging/log_ctrl.h>
#include <tracing.h> #include <debug/tracing.h>
#include <stdbool.h> #include <stdbool.h>
#include <misc/gcov.h> #include <misc/gcov.h>

View file

@ -36,7 +36,7 @@
#include <errno.h> #include <errno.h>
#include <init.h> #include <init.h>
#include <syscall_handler.h> #include <syscall_handler.h>
#include <tracing.h> #include <debug/tracing.h>
/* We use a global spinlock here because some of the synchronization /* We use a global spinlock here because some of the synchronization
* is protecting things like owner thread priorities which aren't * is protecting things like owner thread priorities which aren't

View file

@ -27,7 +27,7 @@
#include <ksched.h> #include <ksched.h>
#include <init.h> #include <init.h>
#include <syscall_handler.h> #include <syscall_handler.h>
#include <tracing.h> #include <debug/tracing.h>
/* We use a system-wide lock to synchronize semaphores, which has /* We use a system-wide lock to synchronize semaphores, which has
* unfortunate performance impact vs. using a per-object lock * unfortunate performance impact vs. using a per-object lock

View file

@ -29,7 +29,7 @@
#include <kernel_internal.h> #include <kernel_internal.h>
#include <kswap.h> #include <kswap.h>
#include <init.h> #include <init.h>
#include <tracing.h> #include <debug/tracing.h>
#include <stdbool.h> #include <stdbool.h>
static struct k_spinlock lock; static struct k_spinlock lock;

View file

@ -9,7 +9,7 @@
#include <irq.h> #include <irq.h>
#include <soc.h> #include <soc.h>
#include <tracing.h> #include <debug/tracing.h>
static ALWAYS_INLINE void riscv_idle(unsigned int key) static ALWAYS_INLINE void riscv_idle(unsigned int key)
{ {