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);
This commit is contained in:
raiden00pl 2023-05-10 19:42:31 +02:00 committed by Alan Carvalho de Assis
parent a906a76734
commit 8726e530d5
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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;
}