break;
case 2:
switch(header->minor_version) {
- case 0:
+ case 2:
{
- struct ltt_subbuffer_header_2_0 *vheader = header;
- tf->buffer_header_size = sizeof(struct ltt_subbuffer_header_2_0) ;
+ struct ltt_subbuffer_header_2_2 *vheader = header;
+ tf->buffer_header_size = ltt_subbuffer_header_size();
tf->tscbits = 27;
tf->eventbits = 5;
tf->tsc_mask = ((1ULL << tf->tscbits) - 1);
// Is the file large enough to contain a trace
if(lTDFStat.st_size <
- (off_t)(sizeof(ltt_subbuffer_header_t))){
+ (off_t)(ltt_subbuffer_header_size())){
g_print("The input data file %s does not contain a trace\n", fileName);
goto close_file;
}
/* Temporarily map the buffer start header to get trace information */
/* Multiple of pages aligned head */
tf->buffer.head = mmap(0,
- PAGE_ALIGN(sizeof(ltt_subbuffer_header_t)), PROT_READ,
+ PAGE_ALIGN(ltt_subbuffer_header_size()), PROT_READ,
MAP_PRIVATE, tf->fd, 0);
if(tf->buffer.head == MAP_FAILED) {
perror("Error in allocating memory for buffer of tracefile");
tf->file_size = lTDFStat.st_size;
tf->buf_size = ltt_get_uint32(LTT_GET_BO(tf), &header->buf_size);
tf->num_blocks = tf->file_size / tf->buf_size;
+ tf->events_lost = 0;
+ tf->subbuf_corrupt = 0;
if(munmap(tf->buffer.head,
- PAGE_ALIGN(sizeof(ltt_subbuffer_header_t)))) {
+ PAGE_ALIGN(ltt_subbuffer_header_size()))) {
g_warning("unmap size : %u\n",
- PAGE_ALIGN(sizeof(ltt_subbuffer_header_t)));
+ PAGE_ALIGN(ltt_subbuffer_header_size()));
perror("munmap error");
g_assert(0);
}
/* Error */
unmap_file:
if(munmap(tf->buffer.head,
- PAGE_ALIGN(sizeof(ltt_subbuffer_header_t)))) {
+ PAGE_ALIGN(ltt_subbuffer_header_size()))) {
g_warning("unmap size : %u\n",
- PAGE_ALIGN(sizeof(ltt_subbuffer_header_t)));
+ PAGE_ALIGN(ltt_subbuffer_header_size()));
perror("munmap error");
g_assert(0);
}
goto metadata_error;
}
- /* Get the trace information for the control/metadata_0 tracefile */
+ /*
+ * Get the trace information for the control/metadata_0 tracefile.
+ * Getting a correct trace start_time and start_tsc is insured by the fact
+ * that no subbuffers are supposed to be lost in the metadata channel.
+ * Therefore, the first subbuffer contains the start_tsc timestamp in its
+ * buffer header.
+ */
g_assert(group->len > 0);
tf = &g_array_index (group, LttTracefile, 0);
header = (ltt_subbuffer_header_t *)tf->buffer.head;
- g_assert(parse_trace_header(header, tf, t) == 0);
+ ret = parse_trace_header(header, tf, t);
+ g_assert(!ret);
t->num_cpu = group->len;
tf->event.block = block_num;
tf->event.offset = 0;
+ if (header->events_lost) {
+ g_warning("%d events lost so far in tracefile %s at block %u",
+ tf->events_lost - header->events_lost,
+ g_quark_to_string(tf->long_name),
+ block_num);
+ tf->events_lost = header->events_lost;
+ }
+ if (header->subbuf_corrupt) {
+ g_warning("%d subbuffer(s) corrupted so far in tracefile %s at block %u",
+ tf->subbuf_corrupt - header->subbuf_corrupt,
+ g_quark_to_string(tf->long_name),
+ block_num);
+ tf->subbuf_corrupt = header->subbuf_corrupt;
+ }
+
return 0;
map_error:
*/
if (likely(info && info->fields)) {
/* alignment */
- tf->event.data += ltt_align((off_t)tf->event.data, info->largest_align,
+ tf->event.data += ltt_align((off_t)(unsigned long)tf->event.data,
+ info->largest_align,
info->alignment);
/* size, dynamically computed */
if (info->size != -1)