tracing: remove stray event_logger code

Remove obsolete kernel event logger code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-09-05 13:41:44 -05:00
commit a9f32d66cf
6 changed files with 1 additions and 384 deletions

View file

@ -505,7 +505,6 @@ void _timer_int_handler(void *params)
SET_TIMER_FIRE_TIME(GET_TIMER_CURRENT_TIME() + _xt_tick_divisor);
#endif
extern void _sys_k_event_logger_interrupt(void);
sys_trace_isr_enter();
#ifdef CONFIG_SMP

View file

@ -1,163 +0,0 @@
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Event logger support.
*/
#ifndef __EVENT_LOGGER_H__
#define __EVENT_LOGGER_H__
#ifdef __cplusplus
extern "C" {
#endif
#define EVENT_HEADER_SIZE 1
#ifndef _ASMLANGUAGE
#include <kernel.h>
#include <errno.h>
#include <ring_buffer.h>
struct event_logger {
struct k_sem sync_sema;
struct ring_buf ring_buf;
};
/**
* @brief Event Logger
* @defgroup event_logger Event Logger
* @{
*/
/**
* @brief Initialize the event logger.
*
* @details This routine initializes the ring buffer.
*
* @param logger Logger to be initialized.
* @param logger_buffer Pointer to the buffer to be used by the logger.
* @param buffer_size Size of the buffer in 32-bit words.
*
* @return N/A
*/
void sys_event_logger_init(struct event_logger *logger,
u32_t *logger_buffer, u32_t buffer_size);
/**
* @brief Send an event message to the logger.
*
* @details This routine adds an event message to the ring buffer and signals
* the sync semaphore to indicate that event messages are available.
*
* @param logger Pointer to the event logger used.
* @param event_id The profiler event's ID.
* @param event_data Pointer to the data of the message.
* @param data_size Size of the buffer in 32-bit words.
*
* @return N/A
*/
void sys_event_logger_put(struct event_logger *logger, u16_t event_id,
u32_t *event_data, u8_t data_size);
/**
* @brief Retrieve an event message from the logger.
*
* @details This routine retrieves an event message from the ring buffer and
* copies it to the provided buffer. If the provided buffer is smaller
* than the message size the function returns -EMSGSIZE. Otherwise, it returns
* the number of 32-bit words copied. The function retrieves messages in
* FIFO order. If there is no message in the buffer the function returns
* immediately. It can only be called from a thread.
*
* @param logger Pointer to the event logger used.
* @param event_id Pointer to the id of the fetched event.
* @param dropped_event_count Pointer to the number of events dropped.
* @param buffer Pointer to the buffer for the copied message.
* @param buffer_size Size of the buffer in 32-bit words. Updated with the
* actual message's size.
*
* @retval EMSGSIZE If the buffer size is smaller than the message size.
* @retval Number of 32-bit words copied.
* @retval 0 If no message was already available.
*/
int sys_event_logger_get(struct event_logger *logger, u16_t *event_id,
u8_t *dropped_event_count, u32_t *buffer,
u8_t *buffer_size);
/**
* @brief Retrieve an event message from the logger, wait if empty.
*
* @details This routine retrieves an event message from the ring buffer
* and copies it to the provided buffer. If the provided buffer is smaller
* than the message size the function returns -EMSGSIZE. Otherwise, it
* returns the number of 32-bit words copied.
*
* The function retrieves messages in FIFO order. The caller pends if there is
* no message available in the buffer. It can only be called from a thread.
*
* @param logger Pointer to the event logger used.
* @param event_id Pointer to the ID of the fetched event.
* @param dropped_event_count Pointer to the number of dropped events.
* @param buffer Pointer to the buffer for the copied messages.
* @param buffer_size Size of the buffer in 32-bit words. Updated with the
* actual message's size.
*
* @retval EMSGSIZE If the buffer size is smaller than the message size.
* @retval Number of DWORDs copied, otherwise.
*/
int sys_event_logger_get_wait(struct event_logger *logger, u16_t *event_id,
u8_t *dropped_event_count, u32_t *buffer,
u8_t *buffer_size);
#ifdef CONFIG_SYS_CLOCK_EXISTS
/**
* @brief Retrieve an event message from the logger, wait with a timeout if
* empty.
*
* @details This routine retrieves an event message from the ring buffer and
* copies it to the provided buffer. If the provided buffer is smaller than
* the message size the routine returns -EMSGSIZE. Otherwise, it returns the
* number of dwords copied. The function retrieves messages in FIFO order.
* If no message is available in the buffer, the caller pends until a
* new message is added or the timeout expires. This routine can only be
* called from a thread.
*
* @param logger Pointer to the event logger used.
* @param event_id Pointer to the ID of the event fetched.
* @param dropped_event_count Pointer to the number of dropped events.
* @param buffer Pointer to the buffer for the copied message.
* @param buffer_size Size of the buffer in 32-bit words. Updated with the
* actual message size.
* @param timeout Timeout in ticks.
*
* @retval EMSGSIZE if the buffer size is smaller than the message size.
* @retval Number of 32-bit words copied.
* @retval 0 If the timeout expired and there was no message already
* available.
*/
int sys_event_logger_get_wait_timeout(struct event_logger *logger,
u16_t *event_id,
u8_t *dropped_event_count,
u32_t *buffer, u8_t *buffer_size,
u32_t timeout);
/**
* @}
*/
#endif /* CONFIG_SYS_CLOCK_EXISTS */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __EVENT_LOGGER_H__ */

View file

@ -276,9 +276,7 @@ static void pend(struct k_thread *thread, _wait_q_t *wait_q, s32_t timeout)
_priq_wait_add(&wait_q->waitq, thread);
}
#ifdef CONFIG_KERNEL_EVENT_LOGGER_THREAD
_sys_k_event_logger_thread_pend(thread);
#endif
sys_trace_thread_pend(thread);
}
void _pend_thread(struct k_thread *thread, _wait_q_t *wait_q, s32_t timeout)

View file

@ -110,29 +110,6 @@ static void do_sem_give(struct k_sem *sem)
}
}
/*
* This function is meant to be called only by
* _sys_event_logger_put_non_preemptible(), which itself is really meant to be
* called only by _sys_k_event_logger_context_switch(), used within a context
* switch to log the event.
*
* WARNING:
* It must be called with interrupts already locked.
* It cannot be called for a sempahore part of a group.
*/
void _sem_give_non_preemptible(struct k_sem *sem)
{
struct k_thread *thread;
thread = _unpend1_no_timeout(&sem->wait_q);
if (!thread) {
increment_count_up_to_limit(sem);
return;
}
_set_thread_return_value(thread, 0);
}
void _impl_k_sem_give(struct k_sem *sem)
{
unsigned int key = irq_lock();

View file

@ -1,165 +0,0 @@
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Event logger support.
*/
#include <logging/event_logger.h>
#include <ring_buffer.h>
#include <kernel_structs.h>
#include <wait_q.h>
void sys_event_logger_init(struct event_logger *logger,
u32_t *logger_buffer, u32_t buffer_size)
{
sys_ring_buf_init(&logger->ring_buf, buffer_size, logger_buffer);
k_sem_init(&(logger->sync_sema), 0, UINT_MAX);
}
static void event_logger_put(struct event_logger *logger, u16_t event_id,
u32_t *event_data, u8_t data_size,
void (*sem_give_fn)(struct k_sem *))
{
int ret;
unsigned int key;
key = irq_lock();
ret = sys_ring_buf_put(&logger->ring_buf, event_id,
logger->ring_buf.dropped_put_count, event_data,
data_size);
if (ret == 0) {
logger->ring_buf.dropped_put_count = 0;
/* inform that there is event data available on the buffer */
sem_give_fn(&(logger->sync_sema));
}
irq_unlock(key);
}
void sys_event_logger_put(struct event_logger *logger, u16_t event_id,
u32_t *event_data, u8_t data_size)
{
/* The thread invoking sys_k_event_logger_get_wait() supposed
* to only read the events of the threads which logged to kernel event
* logger buffer. But it should not write to kernel event logger
* buffer. Otherwise it would cause the race condition.
*/
struct k_thread *event_logger_thread =
_waitq_head(&(logger->sync_sema.wait_q));
if (_current != event_logger_thread) {
event_logger_put(logger, event_id, event_data,
data_size, k_sem_give);
}
}
/**
* @brief Send an event message to the logger with a non preemptible
* behavior.
*
* @details Add an event message to the ring buffer and signal the sync
* semaphore using the internal function _sem_give_non_preemptible to inform
* that there are event messages available, avoiding the preemptible
* behavior when the function is called from a task. This function
* should be only used for special cases where the sys_event_logger_put
* does not satisfy the needs.
*
* @param logger Pointer to the event logger used.
* @param event_id The identification of the profiler event.
* @param data Pointer to the data of the message.
* @param data_size Size of the buffer in 32-bit words.
*
* @return No return value.
*/
void _sys_event_logger_put_non_preemptible(struct event_logger *logger,
u16_t event_id, u32_t *event_data, u8_t data_size)
{
extern void _sem_give_non_preemptible(struct k_sem *sem);
/* The thread invoking sys_k_event_logger_get_wait() supposed
* to only read the events of the threads which logged to kernel event
* logger buffer. But it should not write to kernel event logger
* buffer. Otherwise it would cause the race condition.
*/
struct k_thread *event_logger_thread =
_waitq_head(&(logger->sync_sema.wait_q));
if (_current != event_logger_thread) {
event_logger_put(logger, event_id, event_data, data_size,
_sem_give_non_preemptible);
}
}
static int event_logger_get(struct event_logger *logger,
u16_t *event_id, u8_t *dropped_event_count,
u32_t *buffer, u8_t *buffer_size)
{
int ret;
ret = sys_ring_buf_get(&logger->ring_buf, event_id, dropped_event_count,
buffer, buffer_size);
if (likely(!ret)) {
return *buffer_size;
}
switch (ret) {
case -EMSGSIZE:
/* if the user can not retrieve the message, we increase the
* semaphore to indicate that the message remains in the buffer
*/
k_sem_give(&(logger->sync_sema));
return -EMSGSIZE;
case -EAGAIN:
return 0;
default:
return ret;
}
}
int sys_event_logger_get(struct event_logger *logger, u16_t *event_id,
u8_t *dropped_event_count, u32_t *buffer,
u8_t *buffer_size)
{
if (k_sem_take(&(logger->sync_sema), K_NO_WAIT) == 0) {
return event_logger_get(logger, event_id, dropped_event_count,
buffer, buffer_size);
}
return 0;
}
int sys_event_logger_get_wait(struct event_logger *logger, u16_t *event_id,
u8_t *dropped_event_count, u32_t *buffer,
u8_t *buffer_size)
{
k_sem_take(&(logger->sync_sema), K_FOREVER);
return event_logger_get(logger, event_id, dropped_event_count, buffer,
buffer_size);
}
#ifdef CONFIG_SYS_CLOCK_EXISTS
int sys_event_logger_get_wait_timeout(struct event_logger *logger,
u16_t *event_id,
u8_t *dropped_event_count,
u32_t *buffer, u8_t *buffer_size,
u32_t timeout)
{
if (k_sem_take(&(logger->sync_sema), __ticks_to_ms(timeout))) {
return event_logger_get(logger, event_id, dropped_event_count,
buffer, buffer_size);
}
return 0;
}
#endif /* CONFIG_SYS_CLOCK_EXISTS */

View file

@ -1,29 +0,0 @@
CONFIG_ZTEST=y
CONFIG_SYS_POWER_MANAGEMENT=y
CONFIG_SYS_POWER_DEEP_SLEEP=n
CONFIG_SYS_POWER_LOW_POWER_STATE=y
CONFIG_DEVICE_POWER_MANAGEMENT=y
CONFIG_TICKLESS_IDLE=y
# RTC Wake Event
CONFIG_RTC=y
# COUNTER Wake Event
CONFIG_COUNTER=n
# GPIO 1 Wake Event
CONFIG_GPIO=n
CONFIG_GPIO_QMSI=n
CONFIG_GPIO_QMSI_1=n
# Comparator Wake Event
CONFIG_AIO_COMPARATOR=n
# Enable SoCWatch power event tracing
CONFIG_SOC_WATCH=y
CONFIG_RING_BUFFER=y
CONFIG_IDLE_STACK_SIZE=512
CONFIG_KERNEL_EVENT_LOGGER=y
CONFIG_KERNEL_EVENT_LOGGER_BUFFER_SIZE=16
CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH=y
CONFIG_KERNEL_EVENT_LOGGER_INTERRUPT=y