tracing: move headers under include/tracing

Move tracing.h to include/tracing/ to align with subsystem reorg.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-02-06 09:14:51 -05:00
commit 73008b427c
24 changed files with 173 additions and 159 deletions

View file

@ -1,139 +1,12 @@
/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DEBUG_TRACING_H_
#define ZEPHYR_INCLUDE_DEBUG_TRACING_H_
/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#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_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"
#elif defined CONFIG_TRACING_TEST
#include "tracing_test.h"
#else
/**
* @brief Tracing APIs
* @defgroup tracing_apis Tracing APIs
* @{
*/
/**
* @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 a thread name is set
* @param thread Thread structure
*/
#define sys_trace_thread_name_set(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)
/**
* @brief Called when the cpu enters the idle state
*/
#define sys_trace_idle()
/**
* @}
*/
#ifndef ZEPHYR_INCLUDE_DEBUG_TRACING_H
#define ZEPHYR_INCLUDE_DEBUG_TRACING_H
#warning "This header file has moved, include <tracing/tracing.h> instead."
#endif
#include <tracing/tracing.h>
#endif

View file

@ -1,79 +0,0 @@
/*
* Copyright (c) 2019 Intel corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_TRACE_FORMAT_H
#define ZEPHYR_INCLUDE_TRACE_FORMAT_H
#include <toolchain/common.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief A structure to represent tracing data format.
*/
typedef struct tracing_data {
u8_t *data;
u32_t length;
} __packed tracing_data_t;
/**
* @brief Macro to trace a message in string format.
*/
#define TRACING_STRING(fmt, ...) \
do { \
tracing_format_string(fmt, ##__VA_ARGS__); \
} while (false)
/**
* @brief Macro to format data to tracing data format.
*/
#define TRACING_FORMAT_DATA(x) \
((struct tracing_data){.data = (u8_t *)&(x), .length = sizeof((x))})
/**
* @brief Macro to trace a message in tracing data format.
*
* All the parameters should be struct tracing_data.
*/
#define TRACING_DATA(...) \
do { \
struct tracing_data arg[] = {__VA_ARGS__}; \
\
tracing_format_data(arg, sizeof(arg) / \
sizeof(struct tracing_data)); \
} while (false)
/**
* @brief Tracing a message in string format.
*
* @param str String to format.
* @param ... Variable length arguments.
*/
void tracing_format_string(const char *str, ...);
/**
* @brief Tracing a message in raw data format.
*
* @param data Raw data to be traced.
* @param length Raw data length.
*/
void tracing_format_raw_data(u8_t *data, u32_t length);
/**
* @brief Tracing a message in tracing data format.
*
* @param tracing_data_array Tracing_data format data array to be traced.
* @param count Tracing_data array data count.
*/
void tracing_format_data(tracing_data_t *tracing_data_array, u32_t count);
#ifdef __cplusplus
}
#endif
#endif