typedef guint32 uint32_t;
typedef guint64 uint64_t;
-/* Hardcoded facility load event : this plus an following "name" string */
+/* Hardcoded facility load event : this plus an preceding "name" string */
struct LttFacilityLoad {
guint32 checksum;
guint32 id;
guint32 pointer_size;
guint32 size_t_size;
guint32 alignment;
-};
+} LTT_PACKED_STRUCT;
struct LttFacilityUnload {
guint32 id;
-};
+} LTT_PACKED_STRUCT;
struct LttStateDumpFacilityLoad {
guint32 checksum;
guint32 pointer_size;
guint32 size_t_size;
guint32 alignment;
-};
-
-
+} LTT_PACKED_STRUCT;
typedef struct _TimeHeartbeat {
LttTime time; //Time stamp of this block
unsigned char facility_id;
unsigned char event_id;
uint16_t event_size;
-} __attribute((aligned(8)));
+} LTT_PACKED_STRUCT;
struct ltt_event_header_nohb {
uint64_t timestamp;
unsigned char facility_id;
unsigned char event_id;
uint16_t event_size;
-} __attribute((aligned(8)));
+} LTT_PACKED_STRUCT;
struct ltt_trace_header {
uint32_t magic_number;
uint8_t has_heartbeat;
uint8_t has_alignment; /* Event header alignment */
uint8_t has_tsc;
-} __attribute((aligned(8)));
+} LTT_PACKED_STRUCT;
struct ltt_block_start_header {
uint32_t lost_size; /* Size unused at the end of the buffer */
uint32_t buf_size; /* The size of this sub-buffer */
struct ltt_trace_header trace;
-} __attribute((aligned(8)));
+} LTT_PACKED_STRUCT;
struct _LttType{
/* Points to array of fac_id of all the
* facilities that has this name. */
+ guint32 arch_type;
+ guint32 arch_variant;
+ guint8 arch_size;
guint8 ltt_major_version;
guint8 ltt_minor_version;
guint8 flight_recorder;
guint8 has_heartbeat;
- // guint8 alignment;
+ guint8 has_alignment;
guint8 has_tsc;
GData *tracefiles; //tracefiles groups
LttTracefile *tf;
GArray *group;
int i;
+ struct ltt_block_start_header *header;
t = g_new(LttTrace, 1);
if(!t) goto alloc_error;
goto facilities_error;
}
+ /* Get the trace information for the control/facility 0 tracefile */
+ g_assert(group->len > 0);
+ tf = &g_array_index (group, LttTracefile, 0);
+ header = (struct ltt_block_start_header*)tf->buffer.head;
+ t->arch_type = ltt_get_uint32(LTT_GET_BO(tf), &header->trace.arch_type);
+ t->arch_variant = ltt_get_uint32(LTT_GET_BO(tf), &header->trace.arch_variant);
+ t->arch_size = header->trace.arch_size;
+ t->ltt_major_version = header->trace.major_version;
+ t->ltt_minor_version = header->trace.minor_version;
+ t->flight_recorder = header->trace.flight_recorder;
+ t->has_heartbeat = header->trace.has_heartbeat;
+ t->has_alignment = header->trace.has_alignment;
+ t->has_tsc = header->trace.has_tsc;
+
+
for(i=0; i<group->len; i++) {
tf = &g_array_index (group, LttTracefile, i);
if(ltt_process_facility_tracefile(tf))
goto facilities_error;
}
-
-
return t;
//TODO align
if(tf->trace->has_tsc) {
- 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;
+ 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 {
- /* no overflow */
- tf->buffer.tsc = (tf->buffer.tsc&0xFFFFFFFF00000000ULL)
- | (guint64)event->time.timestamp;
- event->tsc = tf->buffer.tsc;
+ 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);
-
- pos += sizeof(guint32);
} else {
event->time.delta.tv_sec = 0;
event->time.delta.tv_nsec = ltt_get_uint32(LTT_GET_BO(tf),