Fix: test_benchmark: do not match "CPU(s) scaling MHz:"
[lttng-ust.git] / src / common / ringbuffer / frontend_api.h
index 4cf7031b5a9e8fb1958265b2c897511b160bb06d..030169ff4004cbd0def9cf813d02097bdf370b6e 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <urcu/compiler.h>
 
+#include "common/getcpu.h"
 #include "frontend.h"
 
 /**
@@ -25,7 +26,7 @@
  * Returns a nesting level >= 0 on success, -EPERM on failure (nesting
  * count too high).
  *
- * asm volatile and "memory" clobber prevent the compiler from moving
+ * __asm__ __volatile__ and "memory" clobber prevent the compiler from moving
  * instructions out of the ring buffer nesting count. This is required to ensure
  * that probe side-effects which can cause recursion (e.g. unforeseen traps,
  * divisions by 0, ...) are triggered within the incremented nesting count
@@ -81,8 +82,8 @@ int lib_ring_buffer_try_reserve(const struct lttng_ust_ring_buffer_config *confi
        *o_begin = v_read(config, &buf->offset);
        *o_old = *o_begin;
 
-       ctx_private->tsc = lib_ring_buffer_clock_read(chan);
-       if ((int64_t) ctx_private->tsc == -EIO)
+       ctx_private->timestamp = lib_ring_buffer_clock_read(chan);
+       if ((int64_t) ctx_private->timestamp == -EIO)
                return 1;
 
        /*
@@ -92,8 +93,8 @@ int lib_ring_buffer_try_reserve(const struct lttng_ust_ring_buffer_config *confi
         */
        //prefetch(&buf->commit_hot[subbuf_index(*o_begin, chan)]);
 
-       if (last_tsc_overflow(config, buf, ctx_private->tsc))
-               ctx_private->rflags |= RING_BUFFER_RFLAG_FULL_TSC;
+       if (last_timestamp_overflow(config, buf, ctx_private->timestamp))
+               ctx_private->rflags |= RING_BUFFER_RFLAG_FULL_TIMESTAMP;
 
        if (caa_unlikely(subbuf_offset(*o_begin, chan) == 0))
                return 1;
@@ -129,7 +130,8 @@ int lib_ring_buffer_try_reserve(const struct lttng_ust_ring_buffer_config *confi
  * @ctx: ring buffer context. (input and output) Must be already initialized.
  *
  * Atomic wait-free slot reservation. The reserved space starts at the context
- * "pre_offset". Its length is "slot_size". The associated time-stamp is "tsc".
+ * "pre_offset". Its length is "slot_size". The associated time-stamp is
+ * "timestamp".
  *
  * Return :
  *  0 on success.
@@ -178,12 +180,12 @@ int lib_ring_buffer_reserve(const struct lttng_ust_ring_buffer_config *config,
                goto slow_path;
 
        /*
-        * Atomically update last_tsc. This update races against concurrent
-        * atomic updates, but the race will always cause supplementary full TSC
-        * record headers, never the opposite (missing a full TSC record header
-        * when it would be needed).
+        * Atomically update last_timestamp. This update races against concurrent
+        * atomic updates, but the race will always cause supplementary full
+        * timestamp record headers, never the opposite (missing a full
+        * timestamp record header when it would be needed).
         */
-       save_last_tsc(config, buf, ctx_private->tsc);
+       save_last_timestamp(config, buf, ctx_private->timestamp);
 
        /*
         * Push the reader if necessary
@@ -256,7 +258,7 @@ void lib_ring_buffer_commit(const struct lttng_ust_ring_buffer_config *config,
        /*
         * Must count record before incrementing the commit count.
         */
-       subbuffer_count_record(config, ctx, &buf->backend, endidx, handle);
+       subbuffer_count_record(config, ctx);
 
        /*
         * Order all writes to buffer before the commit count update that will
@@ -287,7 +289,7 @@ void lib_ring_buffer_commit(const struct lttng_ust_ring_buffer_config *config,
        commit_count = v_read(config, &cc_hot->cc);
 
        lib_ring_buffer_check_deliver(config, buf, chan, offset_end - 1,
-                                     commit_count, endidx, handle, ctx_private->tsc);
+                                     commit_count, endidx, handle, ctx);
        /*
         * Update used size at each commit. It's needed only for extracting
         * ring_buffer buffers from vmcore, after crash.
@@ -316,17 +318,17 @@ int lib_ring_buffer_try_discard_reserve(const struct lttng_ust_ring_buffer_confi
 
        /*
         * We need to ensure that if the cmpxchg succeeds and discards the
-        * record, the next record will record a full TSC, because it cannot
-        * rely on the last_tsc associated with the discarded record to detect
-        * overflows. The only way to ensure this is to set the last_tsc to 0
-        * (assuming no 64-bit TSC overflow), which forces to write a 64-bit
+        * record, the next record will record a full timestamp, because it cannot
+        * rely on the last_timestamp associated with the discarded record to detect
+        * overflows. The only way to ensure this is to set the last_timestamp to 0
+        * (assuming no 64-bit timestamp overflow), which forces to write a 64-bit
         * timestamp in the next record.
         *
-        * Note: if discard fails, we must leave the TSC in the record header.
-        * It is needed to keep track of TSC overflows for the following
+        * Note: if discard fails, we must leave the timestamp in the record header.
+        * It is needed to keep track of timestamp overflows for the following
         * records.
         */
-       save_last_tsc(config, buf, 0ULL);
+       save_last_timestamp(config, buf, 0ULL);
 
        if (caa_likely(v_cmpxchg(config, &buf->offset, end_offset, ctx_private->pre_offset)
                   != end_offset))
This page took 0.026524 seconds and 4 git commands to generate.