pespin has submitted this change. ( 
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

Take the chance to also deduplicate MAX_LOG_SIZE.

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, 8 insertions(+), 9 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




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 aa5ef63..9c7cf36 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..38e305b 100644
--- a/src/core/logging_gsmtap.c
+++ b/src/core/logging_gsmtap.c
@@ -44,15 +44,14 @@
 #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>

-#define        GSMTAP_LOG_MAX_SIZE 4096
 #define GSMTAP_MSG_MAX_SIZE (sizeof(struct gsmtap_hdr) + \
                             sizeof(struct gsmtap_osmocore_log_hdr) + \
-                            GSMTAP_LOG_MAX_SIZE)
+                            MAX_LOG_SIZE)

 static __thread uint32_t logging_gsmtap_tid;

@@ -156,10 +155,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

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41980?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3772d291f97626ee325731f3515a5110eda70d3d
Gerrit-Change-Number: 41980
Gerrit-PatchSet: 7
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to