clang-tidy: add Chrome-inspired checks
[lttng-tools.git] / src / common / consumer / consumer.hpp
index dd8eb40d44798c8466c7f3d3eaa794ee6d60c169..a28bc160959277431e8555256e1a0d71c559689a 100644 (file)
@@ -253,6 +253,7 @@ struct lttng_consumer_channel {
        uint64_t lost_packets;
 
        bool streams_sent_to_relayd;
+       uint64_t last_consumed_size_sample_sent;
 };
 
 struct stream_subbuffer {
@@ -312,7 +313,7 @@ enum get_next_subbuffer_status {
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*on_wake_up_cb)(struct lttng_consumer_stream *);
+using on_wake_up_cb = int (*)(struct lttng_consumer_stream *);
 
 /*
  * Perform any operation required before a consumer stream is put
@@ -320,16 +321,15 @@ typedef int (*on_wake_up_cb)(struct lttng_consumer_stream *);
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*on_sleep_cb)(struct lttng_consumer_stream *,
-               struct lttng_consumer_local_data *);
+using on_sleep_cb = int (*)(struct lttng_consumer_stream *, struct lttng_consumer_local_data *);
 
 /*
  * Acquire the subbuffer at the current 'consumed' position.
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef enum get_next_subbuffer_status (*get_next_subbuffer_cb)(
-               struct lttng_consumer_stream *, struct stream_subbuffer *);
+using get_next_subbuffer_cb = enum get_next_subbuffer_status (*)(struct lttng_consumer_stream *,
+                                                                struct stream_subbuffer *);
 
 /*
  * Populate the stream_subbuffer's info member. The info to populate
@@ -337,25 +337,25 @@ typedef enum get_next_subbuffer_status (*get_next_subbuffer_cb)(
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*extract_subbuffer_info_cb)(
-               struct lttng_consumer_stream *, struct stream_subbuffer *);
+using extract_subbuffer_info_cb = int (*)(struct lttng_consumer_stream *,
+                                         struct stream_subbuffer *);
 
 /*
  * Invoked after a subbuffer's info has been filled.
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*pre_consume_subbuffer_cb)(struct lttng_consumer_stream *,
-               const struct stream_subbuffer *);
+using pre_consume_subbuffer_cb = int (*)(struct lttng_consumer_stream *,
+                                        const struct stream_subbuffer *);
 
 /*
  * Consume subbuffer contents.
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef ssize_t (*consume_subbuffer_cb)(struct lttng_consumer_local_data *,
-               struct lttng_consumer_stream *,
-               const struct stream_subbuffer *);
+using consume_subbuffer_cb = ssize_t (*)(struct lttng_consumer_local_data *,
+                                        struct lttng_consumer_stream *,
+                                        const struct stream_subbuffer *);
 
 /*
  * Release the current subbuffer and advance the 'consumed' position by
@@ -363,31 +363,30 @@ typedef ssize_t (*consume_subbuffer_cb)(struct lttng_consumer_local_data *,
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*put_next_subbuffer_cb)(struct lttng_consumer_stream *,
-               struct stream_subbuffer *);
+using put_next_subbuffer_cb = int (*)(struct lttng_consumer_stream *, struct stream_subbuffer *);
 
 /*
  * Invoked after consuming a subbuffer.
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*post_consume_cb)(struct lttng_consumer_stream *,
-               const struct stream_subbuffer *,
-               struct lttng_consumer_local_data *);
+using post_consume_cb = int (*)(struct lttng_consumer_stream *,
+                               const struct stream_subbuffer *,
+                               struct lttng_consumer_local_data *);
 
 /*
  * Send a live beacon if no data is available.
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef int (*send_live_beacon_cb)(struct lttng_consumer_stream *);
+using send_live_beacon_cb = int (*)(struct lttng_consumer_stream *);
 
 /*
  * Lock the stream and channel locks and any other stream-type specific
  * lock that need to be acquired during the processing of an
  * availability notification.
  */
-typedef void (*lock_cb)(struct lttng_consumer_stream *);
+using lock_cb = void (*)(struct lttng_consumer_stream *);
 
 /*
  * Unlock the stream and channel locks and any other stream-type specific
@@ -395,14 +394,14 @@ typedef void (*lock_cb)(struct lttng_consumer_stream *);
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef void (*unlock_cb)(struct lttng_consumer_stream *);
+using unlock_cb = void (*)(struct lttng_consumer_stream *);
 
 /*
  * Assert that the stream and channel lock and any other stream type specific
  * lock that need to be acquired during the processing of a read_subbuffer
  * operation is acquired.
  */
-typedef void (*assert_locked_cb)(struct lttng_consumer_stream *);
+using assert_locked_cb = void (*)(struct lttng_consumer_stream *);
 
 /*
  * Invoked when a subbuffer's metadata version does not match the last
@@ -410,7 +409,7 @@ typedef void (*assert_locked_cb)(struct lttng_consumer_stream *);
  *
  * Stream and channel locks are acquired during this call.
  */
-typedef void (*reset_metadata_cb)(struct lttng_consumer_stream *);
+using reset_metadata_cb = void (*)(struct lttng_consumer_stream *);
 
 /*
  * Internal representation of the streams, sessiond_key is used to identify
@@ -900,7 +899,7 @@ const char *lttng_consumer_type_str(enum lttng_consumer_type type)
 /*
  * Init consumer data structures.
  */
-int lttng_consumer_init(void);
+int lttng_consumer_init();
 
 /*
  * Set the error socket for communication with a session daemon.
@@ -930,7 +929,7 @@ void lttng_consumer_should_exit(struct lttng_consumer_local_data *ctx);
 /*
  * Cleanup the daemon's socket on exit.
  */
-void lttng_consumer_cleanup(void);
+void lttng_consumer_cleanup();
 
 /*
  * Poll on the should_quit pipe and the command socket return -1 on error and
@@ -1085,5 +1084,6 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets(
                struct lttng_consumer_channel *channel);
 int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel);
 void lttng_consumer_sigbus_handle(void *addr);
+void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel);
 
 #endif /* LIB_CONSUMER_H */
This page took 0.043046 seconds and 4 git commands to generate.