Use a list instead of hash table to send streams in correct order.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
int nr_streams;
int shm_fd_is_copy;
int wait_fd_is_copy;
+ int cpucount;
};
/* Forward declaration for UST. */
case LTTNG_CONSUMER_KERNEL:
break;
case LTTNG_CONSUMER_UST:
+ stream->cpu = stream->chan->cpucount++;
ret = lttng_ustconsumer_allocate_stream(stream);
if (ret) {
free(stream);
int handle;
char pathname[PATH_MAX];
struct lttng_ust_object_data *obj;
- struct cds_lfht_node node;
+ /* Using a list of streams to keep order. */
+ struct cds_list_head list;
};
/* UST channel */
ua_chan->handle = -1;
ua_chan->obj = NULL;
ua_chan->ctx = hashtable_new(0);
- ua_chan->streams = hashtable_new(0);
+ CDS_INIT_LIST_HEAD(&ua_chan->streams.head);
ua_chan->events = hashtable_new_str(0);
hashtable_node_init(&ua_chan->node, (void *) ua_chan->name,
strlen(ua_chan->name));
memset(ustream, 0, sizeof(struct ltt_ust_stream));
ustream->obj = obj;
ustream->handle = ustream->obj->handle;
- hashtable_node_init(&ustream->node,
- (void *)((unsigned long) ustream->handle), sizeof(void *));
- hashtable_add_unique(ua_chan->streams, &ustream->node);
- ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%lu",
+ /* Order is important */
+ cds_list_add_tail(&ustream->list, &ua_chan->streams.head);
+ ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%u",
uchan->pathname, uchan->name,
- hashtable_get_count(ua_chan->streams) - 1);
+ ua_chan->streams.count++);
if (ret < 0) {
PERROR("asprintf UST create stream");
goto next_chan;
char name[LTTNG_UST_SYM_NAME_LEN];
struct lttng_ust_channel attr;
struct lttng_ust_object_data *obj;
- struct cds_lfht *streams;
+ struct ltt_ust_stream_list streams;
struct cds_lfht *ctx;
struct cds_lfht *events;
struct cds_lfht_node node;
{
int ret, fd;
struct lttcomm_consumer_msg lum;
- struct cds_lfht_iter iter;
- struct cds_lfht_node *node;
+ struct ltt_ust_stream *stream;
DBG("Sending streams of channel %s to UST consumer", uchan->name);
goto error;
}
- rcu_read_lock();
- hashtable_get_first(uchan->streams, &iter);
- while ((node = hashtable_iter_get_node(&iter)) != NULL) {
- struct ltt_ust_stream *stream =
- caa_container_of(node, struct ltt_ust_stream, node);
+ cds_list_for_each_entry(stream, &uchan->streams.head, list) {
int fds[2];
if (!stream->obj->shm_fd) {
- goto next;
+ continue;
}
lum.cmd_type = LTTNG_CONSUMER_ADD_STREAM;
lum.u.stream.channel_key = uchan->obj->shm_fd;
perror("send consumer stream ancillary data");
goto error;
}
-
-next:
- hashtable_get_next(uchan->streams, &iter);
}
- rcu_read_unlock();
DBG("consumer channel streams sent");