pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/41980?usp=email )
Change subject: Use same queue length for gsmtap_log and gsmtap_file ......................................................................
Use same queue length for gsmtap_log and gsmtap_file
Change-Id: I3772d291f97626ee325731f3515a5110eda70d3d --- M include/osmocom/core/logging_internal.h M src/core/logging_file.c M src/core/logging_gsmtap.c 3 files changed, 7 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/41980/1
diff --git a/include/osmocom/core/logging_internal.h b/include/osmocom/core/logging_internal.h index 0cc82a4..e898758 100644 --- a/include/osmocom/core/logging_internal.h +++ b/include/osmocom/core/logging_internal.h @@ -11,6 +11,9 @@ /* maximum length of the log string of a single log event (typically line) */ #define MAX_LOG_SIZE 4096
+/* maximum number of log statements we queue in file/stderr target write queue */ +#define LOG_WQUEUE_LEN 156 + struct log_thread_state { /* Whether we are inside a code path to generate logging output: */ bool logging_active; diff --git a/src/core/logging_file.c b/src/core/logging_file.c index 8b717e9..dc12049 100644 --- a/src/core/logging_file.c +++ b/src/core/logging_file.c @@ -41,9 +41,6 @@ #include <osmocom/core/osmo_io.h> #include <osmocom/core/logging_internal.h>
-/* maximum number of log statements we queue in file/stderr target write queue */ -#define LOG_WQUEUE_LEN 156 - /* NOTE: We use target->tgt_file.wqueue->except_cb to store the struct osmo_io_fd, because the * struct log_target is public and we cannot add pointers to it under tgt->tgt_file... * It can be moved to target->tgt_file.iofd if we are ever able to make struct log_target private... */ diff --git a/src/core/logging_gsmtap.c b/src/core/logging_gsmtap.c index 062efd9..141471d 100644 --- a/src/core/logging_gsmtap.c +++ b/src/core/logging_gsmtap.c @@ -44,7 +44,7 @@ #include <osmocom/core/utils.h> #include <osmocom/core/gsmtap.h> #include <osmocom/core/gsmtap_util.h> -#include <osmocom/core/logging.h> +#include <osmocom/core/logging_internal.h> #include <osmocom/core/timer.h> #include <osmocom/core/byteswap.h> #include <osmocom/core/thread.h> @@ -156,10 +156,10 @@ #ifndef ENABLE_PSEUDOTALLOC size_t num_pool_objects; if (ofd_wq_mode) { - /* Allocate a talloc pool to avoid malloc() on the first 100 - * concurrently queued msgbs (~400KB per gsmtap_log target). + /* Allocate a talloc pool to avoid malloc() on the first 156 + * concurrently queued msgbs (~624KB per gsmtap_log target). * Once the talloc_pool is full, new normal talloc chunks will be used. */ - num_pool_objects = 100; + num_pool_objects = LOG_WQUEUE_LEN; } else { /* When in synchronous mode (blocking & non-blocking), there's * no queueing in gsmtap_sendmsg() so there's no need to have a