diff options
author | Benjamin Walsh <benjamin.walsh@windriver.com> | 2016-10-24 16:30:23 -0400 |
---|---|---|
committer | Anas Nashif <nashif@linux.intel.com> | 2016-10-26 23:38:07 +0000 |
commit | 10f30a5f61158e7ad03821a014b8ea9a480cf340 (patch) | |
tree | 7f83cd5078e6c15a776ccf292e6fd0ac1ffe13b4 /kernel | |
parent | c2aecb26cc03539d612e819909e8329526809eb9 (diff) |
kernel event logger: fix longer-than-80 chars lines
Change-Id: I503c18d339a0731b0fcbb7b83b3dc16b08c2d7a1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/unified/kernel_event_logger.c | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/kernel/unified/kernel_event_logger.c b/kernel/unified/kernel_event_logger.c index 1fd4f8f34..becb0d7f8 100644 --- a/kernel/unified/kernel_event_logger.c +++ b/kernel/unified/kernel_event_logger.c @@ -89,40 +89,44 @@ 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) { - 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 - * 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(&sys_k_event_logger, - KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID, data, - ARRAY_SIZE(data)); + 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 + * 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(&sys_k_event_logger, + KERNEL_EVENT_LOGGER_CONTEXT_SWITCH_EVENT_ID, data, + ARRAY_SIZE(data)); } void sys_k_event_logger_register_as_collector(void) |