Performance: disable event counting by default
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Sep 2016 20:54:20 +0000 (16:54 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Sep 2016 20:56:14 +0000 (16:56 -0400)
Disable event counting in the ring buffer, which can count the number of
events produced per ring-buffer, as well as the number of events
overwritten in overwrite mode.

This feature is currently unused anyway: it is not saved in the ring
buffer header, nor made available to lttng-tools.

This saves 70 ns/event in lttng-ust on the ARM32 Cubietruck.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/backend_internal.h
libringbuffer/ring_buffer_frontend.c

index df3617cacd76dccdd756d870cf56d0e477b8f387..7bd5c738936084a0ed84fec4fa822a44211812f7 100644 (file)
@@ -196,6 +196,11 @@ int subbuffer_id_check_index(const struct lttng_ust_lib_ring_buffer_config *conf
                return 0;
 }
 
+/*
+ * The ring buffer can count events recorded and overwritten per buffer,
+ * but it is disabled by default due to its performance overhead.
+ */
+#ifdef LTTNG_RING_BUFFER_COUNT_EVENTS
 static inline
 void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *config,
                            struct lttng_ust_lib_ring_buffer_backend *bufb,
@@ -206,6 +211,14 @@ void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *confi
        sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
        v_inc(config, &shmp(handle, shmp_index(handle, bufb->array, sb_bindex)->shmp)->records_commit);
 }
+#else /* LTTNG_RING_BUFFER_COUNT_EVENTS */
+static inline
+void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *config,
+                           struct lttng_ust_lib_ring_buffer_backend *bufb,
+                           unsigned long idx, struct lttng_ust_shm_handle *handle)
+{
+}
+#endif /* #else LTTNG_RING_BUFFER_COUNT_EVENTS */
 
 /*
  * Reader has exclusive subbuffer access for record consumption. No need to
index 14ae8eb334b5352c5d831f398a30ad5849acf7fe..1396f44a26263a202867b6f9f2e115275e4d9b35 100644 (file)
@@ -2168,6 +2168,34 @@ void lib_ring_buffer_vmcore_check_deliver(const struct lttng_ust_lib_ring_buffer
                v_set(config, &shmp_index(handle, buf->commit_hot, idx)->seq, commit_count);
 }
 
+/*
+ * The ring buffer can count events recorded and overwritten per buffer,
+ * but it is disabled by default due to its performance overhead.
+ */
+#ifdef LTTNG_RING_BUFFER_COUNT_EVENTS
+static
+void deliver_count_events(const struct lttng_ust_lib_ring_buffer_config *config,
+               struct lttng_ust_lib_ring_buffer *buf,
+               unsigned long idx,
+               struct lttng_ust_shm_handle *handle)
+{
+       v_add(config, subbuffer_get_records_count(config,
+                       &buf->backend, idx, handle),
+               &buf->records_count);
+       v_add(config, subbuffer_count_records_overrun(config,
+                       &buf->backend, idx, handle),
+               &buf->records_overrun);
+}
+#else /* LTTNG_RING_BUFFER_COUNT_EVENTS */
+static
+void deliver_count_events(const struct lttng_ust_lib_ring_buffer_config *config,
+               struct lttng_ust_lib_ring_buffer *buf,
+               unsigned long idx,
+               struct lttng_ust_shm_handle *handle)
+{
+}
+#endif /* #else LTTNG_RING_BUFFER_COUNT_EVENTS */
+
 void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_lib_ring_buffer_config *config,
                                   struct lttng_ust_lib_ring_buffer *buf,
                                   struct channel *chan,
@@ -2221,16 +2249,7 @@ void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_lib_ring_buffer_c
                 * and any other writer trying to access this subbuffer
                 * in this state is required to drop records.
                 */
-               v_add(config,
-                     subbuffer_get_records_count(config,
-                                                 &buf->backend,
-                                                 idx, handle),
-                     &buf->records_count);
-               v_add(config,
-                     subbuffer_count_records_overrun(config,
-                                                     &buf->backend,
-                                                     idx, handle),
-                     &buf->records_overrun);
+               deliver_count_events(config, buf, idx, handle);
                config->cb.buffer_end(buf, tsc, idx,
                                      lib_ring_buffer_get_data_size(config,
                                                                buf,
This page took 0.02716 seconds and 4 git commands to generate.