kernel event logger: fix longer-than-80 chars lines
Change-Id: I503c18d339a0731b0fcbb7b83b3dc16b08c2d7a1 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
c2aecb26cc
commit
10f30a5f61
1 changed files with 30 additions and 26 deletions
|
@ -89,41 +89,45 @@ void _sys_k_event_logger_context_switch(void)
|
|||
uint32_t *event_data,
|
||||
uint8_t data_size);
|
||||
|
||||
if (!sys_k_must_log_event(KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID)) {
|
||||
const int event_id = KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID;
|
||||
|
||||
if (!sys_k_must_log_event(event_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the kernel event logger has not been initialized, we do nothing */
|
||||
/* if the kernel event logger has not been initialized, do nothing */
|
||||
if (sys_k_event_logger.ring_buf.buf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_collector_fiber != _nanokernel.current) {
|
||||
if (_collector_fiber == _nanokernel.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
data[0] = _sys_k_get_time();
|
||||
data[1] = (uint32_t)_nanokernel.current;
|
||||
|
||||
/*
|
||||
* The mechanism we use to log the kernel events uses a sync semaphore
|
||||
* to inform that there are available events to be collected. The
|
||||
* context switch event can be triggered from a task. When we
|
||||
* signal a semaphore from a task and a fiber is waiting for
|
||||
* that semaphore, a context switch is generated immediately. Due to
|
||||
* the fact that we register the context switch event while the context
|
||||
* switch is being processed, a new context switch can be generated
|
||||
* before the kernel finishes processing the current context switch. We
|
||||
* need to prevent this because the kernel is not able to handle it.
|
||||
* The _sem_give_non_preemptible function does not trigger a context
|
||||
* context switch event can be triggered from a task. When we signal a
|
||||
* semaphore from a task and a fiber is waiting for that semaphore, a
|
||||
* context switch is generated immediately. Due to the fact that we
|
||||
* register the context switch event while the context switch is being
|
||||
* processed, a new context switch can be generated before the kernel
|
||||
* finishes processing the current context switch. We need to prevent
|
||||
* this because the kernel is not able to handle it. The
|
||||
* _sem_give_non_preemptible function does not trigger a context
|
||||
* switch when we signal the semaphore from any type of thread. Using
|
||||
* _sys_event_logger_put_non_preemptible function, that internally uses
|
||||
* _sem_give_non_preemptible function for signaling the sync semaphore,
|
||||
* allow us registering the context switch event without triggering any
|
||||
* new context switch during the process.
|
||||
* _sys_event_logger_put_non_preemptible function, that internally
|
||||
* uses _sem_give_non_preemptible function for signaling the sync
|
||||
* semaphore, allow us registering the context switch event without
|
||||
* triggering any new context switch during the process.
|
||||
*/
|
||||
_sys_event_logger_put_non_preemptible(&sys_k_event_logger,
|
||||
KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID, data,
|
||||
ARRAY_SIZE(data));
|
||||
}
|
||||
}
|
||||
|
||||
void sys_k_event_logger_register_as_collector(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue