[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH] lib/ukdebug: expose trace buffer size to the menuconfig



Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx>
---
 lib/ukdebug/Config.uk |  8 +++++++-
 lib/ukdebug/trace.c   | 10 +++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/ukdebug/Config.uk b/lib/ukdebug/Config.uk
index 96fce3a..c844d9a 100644
--- a/lib/ukdebug/Config.uk
+++ b/lib/ukdebug/Config.uk
@@ -78,10 +78,16 @@ config LIBUKDEBUG_ENABLE_ASSERT
 menuconfig LIBUKDEBUG_TRACEPOINTS
        bool "Enable tracepoints"
        default n
+       help
+         Tracepoints are stored in an internal, fixed-size buffer. When the end
+         of the buffer is reached, tracing disables itself.
 if LIBUKDEBUG_TRACEPOINTS
+config LIBUKDEBUG_TRACE_BUFFER_SIZE
+       int "Size of the trace buffer"
+       default 16384
+
 config LIBUKDEBUG_ALL_TRACEPOINTS
        bool "Enable all tracepoints at once"
        default n
 endif
-
 endif
diff --git a/lib/ukdebug/trace.c b/lib/ukdebug/trace.c
index 91cc238..0a13581 100644
--- a/lib/ukdebug/trace.c
+++ b/lib/ukdebug/trace.c
@@ -35,13 +35,13 @@
 #include <stddef.h>
 #include <uk/essentials.h>
 
-/* TODO: Implement a circular buffer. Currently, if the buffer is
- * full, tracing disables itself.
+/* If the buffer is full, tracing disables itself.
+ * Using a circular buffer will not make it better: in any case, losing trace
+ * data is undesired and we should keep this as simple as possible.
  */
-#define UK_TRACE_BUFFER_SIZE 16384
-char uk_trace_buffer[UK_TRACE_BUFFER_SIZE];
+char uk_trace_buffer[CONFIG_LIBUKDEBUG_TRACE_BUFFER_SIZE];
 
-size_t uk_trace_buffer_free = UK_TRACE_BUFFER_SIZE;
+size_t uk_trace_buffer_free = CONFIG_LIBUKDEBUG_TRACE_BUFFER_SIZE;
 char *uk_trace_buffer_writep = uk_trace_buffer;
 
 
-- 
2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.