From 8726e530d5176baa89405ba5a28cc1abdd09f0f0 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 10 May 2023 19:42:31 +0200 Subject: [PATCH] logging/nxscope: add an option to disable lock in channels put interfaces With this option enabled the user can speed up adding a large amount of data to the stream buffer by minimizing the usage of the nxscope lock interface: nxscope_lock(&nxs->nxs); nxscope_put_vfloat(&nxs, 0, data0, 1); nxscope_put_vfloat(&nxs, 1, data1, 1); nxscope_put_vfloat(&nxs, 2, data2, 1); nxscope_put_vfloat(&nxs, 3, data3, 1); nxscope_unlock(&nxs->nxs); --- logging/nxscope/Kconfig | 8 ++++++++ logging/nxscope/nxscope_chan.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/logging/nxscope/Kconfig b/logging/nxscope/Kconfig index 85dd4f0e8..3649b25e9 100644 --- a/logging/nxscope/Kconfig +++ b/logging/nxscope/Kconfig @@ -52,4 +52,12 @@ config LOGGING_NXSCOPE_CRICHANNELS ---help--- Enable the support for non-buffered critical channels +config LOGGING_NXSCOPE_DISABLE_PUTLOCK + bool "NxScope disable lock in channels put interfaces" + default n + ---help--- + This option disables lock in channels put interfaces. + In that case, the user is responsible for ensuring + thread-safe operations with nxscope_lock/nxscope_unlock functions. + endif # LOGGING_NXSCOPE diff --git a/logging/nxscope/nxscope_chan.c b/logging/nxscope/nxscope_chan.c index cd8da2c6b..eac54897c 100644 --- a/logging/nxscope/nxscope_chan.c +++ b/logging/nxscope/nxscope_chan.c @@ -457,7 +457,9 @@ static int nxscope_put_common_m(FAR struct nxscope_s *s, uint8_t type, DEBUGASSERT(s); +#ifndef CONFIG_LOGGING_NXSCOPE_DISABLE_PUTLOCK nxscope_lock(s); +#endif /* Validate data */ @@ -506,7 +508,9 @@ static int nxscope_put_common_m(FAR struct nxscope_s *s, uint8_t type, #endif errout: +#ifndef CONFIG_LOGGING_NXSCOPE_DISABLE_PUTLOCK nxscope_unlock(s); +#endif return ret; }