X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Ftracefile.c;h=79063373e838d6e0f060f0767c850bcb860c64fd;hb=78f79181138e0b98b5db684d6fba4432b32ddce7;hp=e7e213dc9d843b2dfd28d7f2ce9c57d30ee4d7a9;hpb=f5d7967f8c41e4f380d3ea7c4304e68ab5bad8ec;p=lttv.git diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index e7e213dc..79063373 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -3,19 +3,19 @@ * * Complete rewrite from the original version made by XangXiu Yang. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation; + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License Version 2.1 as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H @@ -232,7 +232,7 @@ int parse_trace_header(void *header, LttTracefile *tf, LttTrace *t) t->ltt_minor_version = any->minor_version; t->flight_recorder = any->flight_recorder; t->has_heartbeat = any->has_heartbeat; - t->has_tsc = any->has_tsc; + t->freq_scale = any->freq_scale; } @@ -250,13 +250,13 @@ int parse_trace_header(void *header, LttTracefile *tf, LttTrace *t) return 1; } break; - case 6: + case 7: { - struct ltt_trace_header_0_6 *vheader = - (struct ltt_trace_header_0_6 *)header; + struct ltt_trace_header_0_7 *vheader = + (struct ltt_trace_header_0_7 *)header; tf->buffer_header_size = sizeof(struct ltt_block_start_header) - + sizeof(struct ltt_trace_header_0_6); + + sizeof(struct ltt_trace_header_0_7); if(t) { t->start_freq = ltt_get_uint64(LTT_GET_BO(tf), &vheader->start_freq); @@ -921,8 +921,10 @@ static int ltt_get_facility_description(LttFacility *f, break; case LTT_ARCH_TYPE_ARM: text = "_arm"; + break; case LTT_ARCH_TYPE_PPC64: text = "_ppc64"; + break; case LTT_ARCH_TYPE_X86_64: text = "_x86_64"; break; @@ -1580,6 +1582,10 @@ int ltt_tracefile_seek_position(LttTracefile *tf, const LttEventPosition *ep) { tf->event.offset = ep->offset; + /* Put back the event real tsc */ + tf->event.tsc = ep->tsc; + tf->buffer.tsc = ep->tsc; + err = ltt_tracefile_read_update_event(tf); if(err) goto fail; err = ltt_tracefile_read_op(tf); @@ -1598,12 +1604,11 @@ LttTime ltt_interpolate_time(LttTracefile *tf, LttEvent *event) { LttTime time; - g_assert(tf->trace->has_tsc); - // time = ltt_time_from_uint64( // cycles_2_ns(tf, (guint64)(tf->buffer.tsc - tf->buffer.begin.cycle_count))); time = ltt_time_from_uint64( - (double)(tf->buffer.tsc - tf->trace->start_tsc) * 1000000.0 + (double)(tf->buffer.tsc - tf->trace->start_tsc) + * (1000000000.0 / tf->trace->freq_scale) / (double)tf->trace->start_freq); //time = ltt_time_add(tf->buffer.begin.timestamp, time); time = ltt_time_add(tf->trace->start_time_from_tsc, time); @@ -1719,43 +1724,29 @@ int ltt_tracefile_read_update_event(LttTracefile *tf) /* Align the head */ pos += ltt_align((size_t)pos, tf->trace->arch_size, tf->has_alignment); - if(tf->trace->has_tsc) { - if(tf->trace->has_heartbeat) { - event->time.timestamp = ltt_get_uint32(LTT_GET_BO(tf), - pos); - /* 32 bits -> 64 bits tsc */ - /* note : still works for seek and non seek cases. */ - if(event->time.timestamp < (0xFFFFFFFFULL&tf->buffer.tsc)) { - tf->buffer.tsc = ((tf->buffer.tsc&0xFFFFFFFF00000000ULL) - + 0x100000000ULL) - | (guint64)event->time.timestamp; - event->tsc = tf->buffer.tsc; - } else { - /* no overflow */ - tf->buffer.tsc = (tf->buffer.tsc&0xFFFFFFFF00000000ULL) - | (guint64)event->time.timestamp; - event->tsc = tf->buffer.tsc; - } - pos += sizeof(guint32); - } else { - event->tsc = ltt_get_uint64(LTT_GET_BO(tf), pos); - tf->buffer.tsc = event->tsc; - pos += sizeof(guint64); - } - - event->event_time = ltt_interpolate_time(tf, event); - } else { - event->time.delta.tv_sec = 0; - event->time.delta.tv_nsec = ltt_get_uint32(LTT_GET_BO(tf), - pos) * NSEC_PER_USEC; - tf->buffer.tsc = 0; - event->tsc = tf->buffer.tsc; - - event->event_time = ltt_time_add(tf->buffer.begin.timestamp, - event->time.delta); - pos += sizeof(guint32); - } - + if(tf->trace->has_heartbeat) { + event->timestamp = ltt_get_uint32(LTT_GET_BO(tf), + pos); + /* 32 bits -> 64 bits tsc */ + /* note : still works for seek and non seek cases. */ + if(event->timestamp < (0xFFFFFFFFULL&tf->buffer.tsc)) { + tf->buffer.tsc = ((tf->buffer.tsc&0xFFFFFFFF00000000ULL) + + 0x100000000ULL) + | (guint64)event->timestamp; + event->tsc = tf->buffer.tsc; + } else { + /* no overflow */ + tf->buffer.tsc = (tf->buffer.tsc&0xFFFFFFFF00000000ULL) + | (guint64)event->timestamp; + event->tsc = tf->buffer.tsc; + } + pos += sizeof(guint32); + } else { + event->tsc = ltt_get_uint64(LTT_GET_BO(tf), pos); + tf->buffer.tsc = event->tsc; + pos += sizeof(guint64); + } + event->event_time = ltt_interpolate_time(tf, event); event->facility_id = *(guint8*)pos; pos += sizeof(guint8); @@ -1970,6 +1961,10 @@ void ltt_update_event_size(LttTracefile *tf) tf->event.data_size = size; /* Check consistency between kernel and LTTV structure sizes */ + if(tf->event.event_size == 0xFFFF) { + /* Event size too big to fit in the event size field */ + tf->event.event_size = tf->event.data_size; + } g_assert(tf->event.data_size == tf->event.event_size); return; @@ -2666,6 +2661,10 @@ gint check_fields_compatibility(LttEventType *event_type1, different = 1; goto end; } + if(type1->network != type2->network) { + different = 1; + goto end; + } switch(type1->type_class) { case LTT_INT_FIXED: