From e939e5b28722833093a9ae3bede5314359e56080 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 16 Dec 2005 21:24:48 +0000 Subject: [PATCH] support trace version 0.5 git-svn-id: http://ltt.polymtl.ca/svn@1408 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/ltt-private.h | 31 +++++++++++++++++++++++++++-- ltt/branches/poly/ltt/tracefile.c | 25 +++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 7327ca79..5dde4632 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -200,14 +200,41 @@ struct ltt_trace_header_0_4 { } LTT_PACKED_STRUCT; +/* For version 0.5 */ + +struct ltt_trace_header_0_5 { + uint32_t magic_number; + uint32_t arch_type; + uint32_t arch_variant; + uint32_t float_word_order; + uint8_t arch_size; + uint8_t major_version; + uint8_t minor_version; + uint8_t flight_recorder; + uint8_t has_heartbeat; + uint8_t has_alignment; /* Event header alignment */ + uint8_t has_tsc; + uint64_t start_freq; + uint64_t start_tsc; + uint64_t start_monotonic; + //struct timespec start_time; // not portable + uint64_t start_time_sec; + uint64_t start_time_usec; +} LTT_PACKED_STRUCT; + + struct ltt_block_start_header { struct { - struct timeval timestamp; + //struct timeval timestamp; + uint64_t timestamp_sec; + uint64_t timestamp_usec; uint64_t cycle_count; uint64_t freq; } begin; struct { - struct timeval timestamp; + //struct timeval timestamp; + uint64_t timestamp_sec; + uint64_t timestamp_usec; uint64_t cycle_count; uint64_t freq; } end; diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 2a12480d..de046b16 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -273,6 +273,31 @@ int parse_trace_header(void *header, LttTracefile *tf, LttTrace *t) } } break; + case 5: + { + struct ltt_trace_header_0_5 *vheader = + (struct ltt_trace_header_0_5 *)header; + tf->buffer_header_size = + sizeof(struct ltt_block_start_header) + + sizeof(struct ltt_trace_header_0_5); + if(t) { + t->start_freq = ltt_get_uint64(LTT_GET_BO(tf), + &vheader->start_freq); + t->start_tsc = ltt_get_uint64(LTT_GET_BO(tf), + &vheader->start_tsc); + t->start_monotonic = ltt_get_uint64(LTT_GET_BO(tf), + &vheader->start_monotonic); + t->start_time.tv_sec = ltt_get_uint64(LTT_GET_BO(tf), + &vheader->start_time_sec); + t->start_time.tv_nsec = ltt_get_uint64(LTT_GET_BO(tf), + &vheader->start_time_usec); + t->start_time.tv_nsec *= 1000; /* microsec to nanosec */ + + t->start_time_from_tsc = ltt_time_from_uint64( + (double)t->start_tsc * 1000000.0 / (double)t->start_freq); + } + } + break; default: g_warning("Unsupported trace version : %hhu.%hhu", any->major_version, any->minor_version); -- 2.34.1