Fix: add missing debug printout to identify the cause of lost events
[lttng-ust.git] / libringbuffer / ring_buffer_frontend.c
index d0649f3e36b9e33b0e1b247854fd6a2c000f714a..9d89c6fa68a7117b06b1701f17d33b2b3762e308 100644 (file)
@@ -38,6 +38,7 @@
  * Dual LGPL v2.1/GPL v2 license.
  */
 
+#define _GNU_SOURCE
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -92,7 +93,8 @@ __thread unsigned int lib_ring_buffer_nesting;
 static
 void lib_ring_buffer_print_errors(struct channel *chan,
                                  struct lttng_ust_lib_ring_buffer *buf, int cpu,
-                                 struct lttng_ust_shm_handle *handle);
+                                 struct lttng_ust_shm_handle *handle)
+       __attribute__((unused));
 
 /**
  * lib_ring_buffer_reset - Reset ring buffer to initial values.
@@ -1339,6 +1341,7 @@ int lib_ring_buffer_try_reserve_slow(struct lttng_ust_lib_ring_buffer *buf,
                                 * and we are full : record is lost.
                                 */
                                v_inc(config, &buf->records_lost_full);
+                               DBG("Record lost: buffer is full\n");
                                return -ENOBUFS;
                        } else {
                                /*
@@ -1356,6 +1359,7 @@ int lib_ring_buffer_try_reserve_slow(struct lttng_ust_lib_ring_buffer *buf,
                         * many nested writes over a reserve/commit pair.
                         */
                        v_inc(config, &buf->records_lost_wrap);
+                       DBG("Record lost: buffer wrap-around\n");
                        return -EIO;
                }
                offsets->size =
@@ -1374,6 +1378,7 @@ int lib_ring_buffer_try_reserve_slow(struct lttng_ust_lib_ring_buffer *buf,
                         * complete the sub-buffer switch.
                         */
                        v_inc(config, &buf->records_lost_big);
+                       DBG("Record lost: record size (%zu bytes) is too large for buffer\n", offsets->size);
                        return -ENOSPC;
                } else {
                        /*
This page took 0.049639 seconds and 4 git commands to generate.