X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Flttng-relayd.h;h=b5e7c75fdd4b901140c9ec91088791cd1b9f599b;hp=0af8e0f1d963199b5a6bb82c28b244a33daa6b6c;hb=80e8027abb847655ebe43b2b5aec1a5141bb9668;hpb=cef0f7d51b8025d3ba04e6496242c1cca1641aa6 diff --git a/src/bin/lttng-relayd/lttng-relayd.h b/src/bin/lttng-relayd/lttng-relayd.h index 0af8e0f1d..b5e7c75fd 100644 --- a/src/bin/lttng-relayd/lttng-relayd.h +++ b/src/bin/lttng-relayd/lttng-relayd.h @@ -23,9 +23,10 @@ #include #include #include +#include #include -#include +#include #include "ctf-trace.h" @@ -44,6 +45,16 @@ enum connection_type { RELAY_VIEWER_NOTIFICATION = 4, }; +/* + * When we receive a stream, it gets stored in a list (on a per connection + * basis) until we have all the streams of the same channel and the metadata + * associated with it, then it gets flagged with viewer_ready. + */ +struct relay_stream_recv_handle { + uint64_t id; /* stream handle */ + struct cds_list_head node; +}; + /* * Represents a session for the relay point of view */ @@ -72,6 +83,18 @@ struct relay_session { */ uint64_t minor; uint64_t major; + /* + * Flag checked and exchanged with uatomic_cmpxchg to tell the + * viewer-side if new streams got added since the last check. + */ + unsigned long new_streams; + + /* + * Used to synchronize the process where we flag every streams readiness + * for the viewer when the streams_sent message is received and the viewer + * process of sending those streams. + */ + pthread_mutex_t viewer_ready_lock; }; /* @@ -144,6 +167,11 @@ struct relay_stream { * update the oldest_tracefile_id. */ unsigned int tracefile_overwrite:1; + /* + * Can this stream be used by a viewer or are we waiting for additional + * information. + */ + unsigned int viewer_ready:1; }; /* @@ -163,12 +191,16 @@ struct relay_viewer_stream { uint64_t total_index_received; uint64_t tracefile_count; uint64_t tracefile_count_current; + /* Stop after reading this tracefile. */ + uint64_t tracefile_count_last; struct lttng_ht_node_u64 stream_n; struct rcu_head rcu_node; struct ctf_trace *ctf_trace; /* * This lock blocks only when the writer is about to start overwriting * a file currently read by the reader. + * + * This is nested INSIDE the viewer_stream_rotation_lock. */ pthread_mutex_t overwrite_lock; /* Information telling us if the stream is a metadata stream. */ @@ -183,6 +215,8 @@ struct relay_viewer_stream { * it sets this flag to inform that it is a normal error. */ unsigned int abort_flag:1; + /* Indicates if this stream has been sent to a viewer client. */ + unsigned int sent_flag:1; }; /* @@ -196,12 +230,13 @@ struct relay_command { struct lttng_ht_node_ulong sock_n; struct rcu_head rcu_node; enum connection_type type; - unsigned int version_check_done:1; /* protocol version to use for this session */ uint32_t major; uint32_t minor; struct lttng_ht *ctf_traces_ht; /* indexed by path name */ uint64_t session_id; + struct cds_list_head recv_head; + unsigned int version_check_done:1; }; struct relay_local_data { @@ -216,6 +251,11 @@ extern struct lttng_ht *indexes_ht; extern const char *tracing_group_name; +extern const char * const config_section_name; + +extern int thread_quit_pipe[2]; + struct relay_stream *relay_stream_find_by_id(uint64_t stream_id); +void lttng_relay_notify_ready(void); #endif /* LTTNG_RELAYD_H */