From 2e5f0a07c7a1b55f0adf350930c7ce4c21279770 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Tue, 24 Oct 2017 10:21:57 +0200
Subject: [PATCH] minor: fix tracing utility (no malloc for it takes too long
 at startup)

---
 openair2/PHY_INTERFACE/IF_Module.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index b1014e8bde4..ab6551f61c1 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -156,6 +156,9 @@ void handle_ulsch(UL_IND_t *UL_info) {
 #define C do { size = 0; put(0); } while (0)
 #define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0)
 
+#if 0
+
+/* eats lots of ms at startup, disrupts realtime */
 static char *s;
 static int size;
 static int maxsize;
@@ -169,6 +172,22 @@ static void put(char x)
   s[size++] = x;
 }
 
+#else
+
+/* eats nothing at startup, but fixed size */
+#define SMAX 65536
+static char s[SMAX];
+static int size;
+static int maxsize = SMAX;
+
+static void put(char x)
+{
+  if (size == maxsize) { printf("incrase SMAX\n"); exit(1); }
+  s[size++] = x;
+}
+
+#endif
+
 static void append_string(char *t)
 {
   size--;
-- 
GitLab