From: Pierre-Marc Fournier Date: Mon, 8 Feb 2010 22:47:30 +0000 (-0500) Subject: port to trace format 2.5 X-Git-Tag: v1.9.1~748 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8c36d1ee4e2c77783f6edfdd49f2d812afdd3f67;p=lttng-ust.git port to trace format 2.5 --- diff --git a/libust/buffers.c b/libust/buffers.c index c644cfb7..33c95898 100644 --- a/libust/buffers.c +++ b/libust/buffers.c @@ -307,8 +307,7 @@ static void ltt_buffer_begin(struct ust_buffer *buf, subbuf_idx * buf->chan->subbuf_size); header->cycle_count_begin = tsc; - header->lost_size = 0xFFFFFFFF; /* for debugging */ - header->buf_size = buf->chan->subbuf_size; + header->data_size = 0xFFFFFFFF; /* for debugging */ ltt_write_trace_header(channel->trace, header); } @@ -323,9 +322,10 @@ static notrace void ltt_buffer_end(struct ust_buffer *buf, (struct ltt_subbuffer_header *) ust_buffers_offset_address(buf, subbuf_idx * buf->chan->subbuf_size); + u32 data_size = SUBBUF_OFFSET(offset - 1, buf->chan) + 1; - header->lost_size = SUBBUF_OFFSET((buf->chan->subbuf_size - offset), - buf->chan); + header->data_size = data_size; + header->sb_size = PAGE_ALIGN(data_size); header->cycle_count_end = tsc; header->events_lost = local_read(&buf->events_lost); header->subbuf_corrupt = local_read(&buf->corrupted_subbuffers); diff --git a/libust/buffers.h b/libust/buffers.h index bff3ed54..951c9b01 100644 --- a/libust/buffers.h +++ b/libust/buffers.h @@ -413,9 +413,9 @@ static __inline__ void ltt_force_switch(struct ust_buffer *buf, /* * for flight recording. must be called after relay_commit. - * This function decrements de subbuffer's lost_size each time the commit count - * reaches back the reserve offset (module subbuffer size). It is useful for - * crash dump. + * This function increments the subbuffers's commit_seq counter each time the + * commit count reaches back the reserve offset (module subbuffer size). It is + * useful for crash dump. */ #ifdef CONFIG_LTT_VMCORE static __inline__ void ltt_write_commit_counter(struct rchan_buf *buf, @@ -501,7 +501,7 @@ static __inline__ void ltt_commit_slot( ltt_check_deliver(chan, buf, offset_end - 1, commit_count, endidx); /* - * Update lost_size for each commit. It's needed only for extracting + * Update data_size for each commit. It's needed only for extracting * ltt buffers from vmcore, after crash. */ ltt_write_commit_counter(buf, endidx, buf_offset, commit_count, data_size); diff --git a/libust/serialize.c b/libust/serialize.c index 6a868842..a9c6f69b 100644 --- a/libust/serialize.c +++ b/libust/serialize.c @@ -647,7 +647,6 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, largest_align = 1; /* must be non-zero for ltt_align */ data_size = ltt_get_data_size(&closure, serialize_private, &largest_align, fmt, &args_copy); - largest_align = min_t(int, largest_align, sizeof(void *)); va_end(args_copy); /* Iterate on each trace */ diff --git a/libust/tracer.h b/libust/tracer.h index 431a77c6..5d226cd6 100644 --- a/libust/tracer.h +++ b/libust/tracer.h @@ -32,6 +32,7 @@ #include "tracerconst.h" #include #include +#include "buffers.h" /* Number of bytes to log with a read/write event */ #define LTT_LOG_RW_SIZE 32L @@ -213,8 +214,8 @@ struct ltt_subbuffer_header { * used all along the trace. */ uint32_t freq_scale; /* Frequency scaling (divisor) */ - uint32_t lost_size; /* Size unused at end of subbuffer */ - uint32_t buf_size; /* Size of this subbuffer */ + uint32_t data_size; /* Size of data in subbuffer */ + uint32_t sb_size; /* Subbuffer size (including padding) */ uint32_t events_lost; /* * Events lost in this subbuffer since * the beginning of the trace. @@ -264,7 +265,7 @@ extern size_t ltt_write_event_header_slow(struct ust_trace *trace, * returns : offset where the event data must be written. */ static __inline__ size_t ltt_write_event_header(struct ust_trace *trace, - struct ust_channel *channel, + struct ust_channel *chan, struct ust_buffer *buf, long buf_offset, u16 eID, u32 event_size, u64 tsc, unsigned int rflags) @@ -275,11 +276,14 @@ static __inline__ size_t ltt_write_event_header(struct ust_trace *trace, goto slow_path; header.id_time = eID << LTT_TSC_BITS; + header.id_time |= (u32)tsc & LTT_TSC_MASK; + ust_buffers_write(buf, buf_offset, &header, sizeof(header)); + buf_offset += sizeof(header); return buf_offset; slow_path: - return ltt_write_event_header_slow(trace, channel, buf, buf_offset, + return ltt_write_event_header_slow(trace, chan, buf, buf_offset, eID, event_size, tsc, rflags); } @@ -313,7 +317,7 @@ slow_path: #define LTT_DEFAULT_N_SUBBUFS_HIGH 2 #define LTT_TRACER_MAGIC_NUMBER 0x00D6B7ED #define LTT_TRACER_VERSION_MAJOR 2 -#define LTT_TRACER_VERSION_MINOR 4 +#define LTT_TRACER_VERSION_MINOR 5 /** * ust_write_trace_header - Write trace header diff --git a/ustd/lowlevel.c b/ustd/lowlevel.c index 6295a8bc..bce1d20f 100644 --- a/ustd/lowlevel.c +++ b/ustd/lowlevel.c @@ -78,18 +78,18 @@ void finish_consuming_dead_subbuffer(struct buffer_info *buf) if (((commit_seq - buf->subbuf_size) & commit_seq_mask) - (USTD_BUFFER_TRUNC(consumed_offset, buf) >> n_subbufs_order) == 0) { - /* If it was, we only check the lost_size. This is the lost padding at the end of - * the subbuffer. */ - valid_length = (unsigned long)buf->subbuf_size - header->lost_size; + /* If it was, we only check the data_size. This is the amount of valid data at + * the beginning of the subbuffer. */ + valid_length = header->data_size; } else { - /* If the subbuffer was not fully written, then we don't check lost_size because + /* If the subbuffer was not fully written, then we don't check data_size because * it hasn't been written yet. Instead we check commit_seq and use it to choose - * a value for lost_size. The viewer will need this value when parsing. + * a value for data_size. The viewer will need this value when parsing. */ valid_length = commit_seq & (buf->subbuf_size-1); - header->lost_size = buf->subbuf_size-valid_length; + header->data_size = valid_length; assert(i_subbuf == (last_subbuf % buf->n_subbufs)); }