Callstack context: bump number of entries to 128
[lttng-modules.git] / lttng-context-callstack.c
index 4dd984be40fee4e3ef6ba9bbbc2d153244f50ee1..fd730bbc164090bdaf9ef708a4265894de2154a7 100644 (file)
@@ -32,7 +32,7 @@
  *
  *   size = cpus * nest * depth * sizeof(unsigned long)
  *
- * Which is about 800 bytes per CPU on 64-bit host and a depth of 25.
+ * Which is 4096 bytes per CPU on 64-bit host and a depth of 128.
  * The allocation is done at the initialization to avoid memory
  * allocation overhead while tracing, using a shallow stack.
  *
@@ -62,7 +62,7 @@
 #include "wrapper/vmalloc.h"
 #include "lttng-tracer.h"
 
-#define MAX_ENTRIES 25
+#define MAX_ENTRIES 128
 
 enum lttng_cs_ctx_modes {
        CALLSTACK_KERNEL = 0,
@@ -152,17 +152,17 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
                                struct lib_ring_buffer_ctx *ctx,
                                struct lttng_channel *chan)
 {
-       size_t size = 0;
        struct stack_trace *trace;
        struct field_data *fdata = field->priv;
+       size_t orig_offset = offset;
 
        /* do not write data if no space is available */
        trace = stack_trace_context(field, ctx);
        if (unlikely(!trace)) {
-               size += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
-               size += sizeof(unsigned int);
-               size += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
-               return size;
+               offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
+               offset += sizeof(unsigned int);
+               offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
+               return offset - orig_offset;
        }
 
        /* reset stack trace, no need to clear memory */
@@ -179,14 +179,14 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
                        && trace->entries[trace->nr_entries - 1] == ULONG_MAX) {
                trace->nr_entries--;
        }
-       size += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
-       size += sizeof(unsigned int);
-       size += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
-       size += sizeof(unsigned long) * trace->nr_entries;
+       offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
+       offset += sizeof(unsigned int);
+       offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
+       offset += sizeof(unsigned long) * trace->nr_entries;
        /* Add our own ULONG_MAX delimiter to show incomplete stack. */
        if (trace->nr_entries == trace->max_entries)
-               size += sizeof(unsigned long);
-       return size;
+               offset += sizeof(unsigned long);
+       return offset - orig_offset;
 }
 
 static
This page took 0.024811 seconds and 4 git commands to generate.