X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Ftracefile-array.c;h=c7a86966fc5d6bff46b41b00a8513b8f82b0e290;hp=3d62317ac76d7a6fbe2d731a9991aa788181db78;hb=6ec9dc48cf7f3d5e1fc01f741197c0bacc94bbf0;hpb=78118e3bdace1208479db18df6553ab9c4400426 diff --git a/src/bin/lttng-relayd/tracefile-array.c b/src/bin/lttng-relayd/tracefile-array.c index 3d62317ac..c7a86966f 100644 --- a/src/bin/lttng-relayd/tracefile-array.c +++ b/src/bin/lttng-relayd/tracefile-array.c @@ -62,6 +62,22 @@ void tracefile_array_destroy(struct tracefile_array *tfa) free(tfa); } +void tracefile_array_reset(struct tracefile_array *tfa) +{ + size_t count, i; + + count = tfa->count; + for (i = 0; i < count; i++) { + tfa->tf[i].seq_head = -1ULL; + tfa->tf[i].seq_tail = -1ULL; + } + tfa->seq_head = -1ULL; + tfa->seq_tail = -1ULL; + tfa->file_head_read = 0; + tfa->file_head_write = 0; + tfa->file_tail = 0; +} + void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type) { @@ -104,15 +120,16 @@ void tracefile_array_file_rotate(struct tracefile_array *tfa, } } -void tracefile_array_commit_seq(struct tracefile_array *tfa) +void tracefile_array_commit_seq(struct tracefile_array *tfa, + uint64_t new_seq_head) { uint64_t *headp, *tailp; /* Increment overall head. */ - tfa->seq_head++; - /* If we are committing our first index overall, set tail to 0. */ + tfa->seq_head = new_seq_head; + /* If we are committing our first index overall, set tail to head. */ if (tfa->seq_tail == -1ULL) { - tfa->seq_tail = 0; + tfa->seq_tail = new_seq_head; } if (!tfa->count) { /* Not in tracefile rotation mode. */