From: compudj Date: Fri, 24 Dec 2004 15:04:50 +0000 (+0000) Subject: many compile fix X-Git-Tag: v0.12.20~2638 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0f7f40c1b766872829fdac2f76d3c2cf1bb10db8;p=lttv.git many compile fix git-svn-id: http://ltt.polymtl.ca/svn@851 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/Makefile.am b/ltt/branches/poly/ltt/Makefile.am index 66120c42..50dc8fb3 100644 --- a/ltt/branches/poly/ltt/Makefile.am +++ b/ltt/branches/poly/ltt/Makefile.am @@ -22,6 +22,7 @@ lttinclude_HEADERS = \ ltt.h\ time.h\ trace.h\ - type.h + type.h\ + ltt-types.h EXTRA_DIST = crc32.tab diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 438c3597..fab8ed32 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -28,6 +28,7 @@ #include "ltt-private.h" #include #include +#include LttEvent *ltt_event_new() @@ -49,12 +50,13 @@ void ltt_event_destroy(LttEvent *event) * offsetParent : offset from the parent * fld : field * evD : event data + * reverse_byte_order : 1 or 0 *Return value * int : size of the field ****************************************************************************/ int ltt_event_refresh_fields(int offsetRoot,int offsetParent, - LttField * fld, void *evD) + LttField * fld, void *evD, gboolean reverse_byte_order) { int size, size1, element_number, i, offset1, offset2; LttType * type = fld->field_type; @@ -66,14 +68,14 @@ int ltt_event_refresh_fields(int offsetRoot,int offsetParent, size = 0; for(i=0;ichild[0], evD+size); + fld->child[0], evD+size, reverse_byte_order); } }else size = fld->field_size; break; case LTT_SEQUENCE: size1 = fld->sequ_number_size; - element_number = getIntNumber(size1,evD); + element_number = getIntNumber(reverse_byte_order,size1,evD); type->element_number = element_number; if(fld->element_size > 0){ size = element_number * fld->element_size; @@ -81,7 +83,7 @@ int ltt_event_refresh_fields(int offsetRoot,int offsetParent, size = 0; for(i=0;ichild[0], evD+size+size1); + fld->child[0], evD+size+size1, reverse_byte_order); } size += size1; } @@ -98,7 +100,7 @@ int ltt_event_refresh_fields(int offsetRoot,int offsetParent, offset2 = 0; for(i=0;ichild[i],evD+offset2); + fld->child[i],evD+offset2, reverse_byte_order); offset1 += size; offset2 += size; } @@ -239,7 +241,8 @@ LttField *ltt_event_field(LttEvent *e) event_type->latest_event = e->which_event; if(unlikely(field->field_fixed != 1)) - ltt_event_refresh_fields(0, 0, field, e->data); + ltt_event_refresh_fields(0, 0, field, e->data, + e->tracefile->trace->reverse_byte_order); } return field; } @@ -502,7 +505,8 @@ unsigned ltt_event_field_element_number(LttEvent *e, LttField *f) if(f->field_type->type_class == LTT_ARRAY) return f->field_type->element_number; - return (unsigned) getIntNumber(f->sequ_number_size, e + f->offset_root); + return (unsigned) getIntNumber(e->tracefile->trace->reverse_byte_order, + f->sequ_number_size, e + f->offset_root); } /***************************************************************************** @@ -538,7 +542,8 @@ void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i) evD = e->data + f->offset_root; size = 0; for(k=0;koffset_root+size,size, fld, evD+size); + size += ltt_event_refresh_fields(f->offset_root+size,size, fld, evD+size, + e->tracefile->trace->reverse_byte_order); } f->current_element = i - 1; } @@ -550,8 +555,10 @@ void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i) guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; + LttTypeEnum t = f->field_type->type_class; g_assert(t == LTT_UINT || t == LTT_ENUM); @@ -560,17 +567,9 @@ guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f) guint8 x = *(guint8 *)(e->data + f->offset_root); return (guint32) x; }else if(f->field_size == 2){ - guint16 x = *(guint16 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (guint32) (revFlag ? GUINT16_FROM_BE(x): x); - else - return (guint32) (revFlag ? GUINT16_FROM_LE(x): x); + return (guint32)ltt_get_uint16(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 4){ - guint32 x = *(guint32 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (guint32) (revFlag ? GUINT32_FROM_BE(x): x); - else - return (guint32) (revFlag ? GUINT32_FROM_LE(x): x); + return (guint32)ltt_get_uint32(reverse_byte_order, e->data + f->offset_root); } #if 0 else if(f->field_size == 8){ @@ -587,8 +586,9 @@ guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f) gint32 ltt_event_get_int(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; g_assert(f->field_type->type_class == LTT_INT); @@ -596,17 +596,9 @@ gint32 ltt_event_get_int(LttEvent *e, LttField *f) gint8 x = *(gint8 *)(e->data + f->offset_root); return (gint32) x; }else if(f->field_size == 2){ - gint16 x = *(gint16 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (gint32) (revFlag ? GINT16_FROM_BE(x): x); - else - return (gint32) (revFlag ? GINT16_FROM_LE(x): x); + return (gint32)ltt_get_int16(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 4){ - gint32 x = *(gint32 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (gint32) (revFlag ? GINT32_FROM_BE(x): x); - else - return (gint32) (revFlag ? GINT32_FROM_LE(x): x); + return (gint32)ltt_get_int32(reverse_byte_order, e->data + f->offset_root); } #if 0 else if(f->field_size == 8){ @@ -623,8 +615,9 @@ gint32 ltt_event_get_int(LttEvent *e, LttField *f) guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; LttTypeEnum t = f->field_type->type_class; g_assert(t == LTT_UINT || t == LTT_ENUM); @@ -633,23 +626,11 @@ guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f) guint8 x = *(guint8 *)(e->data + f->offset_root); return (guint64) x; }else if(f->field_size == 2){ - guint16 x = *(guint16 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (guint64) (revFlag ? GUINT16_FROM_BE(x): x); - else - return (guint64) (revFlag ? GUINT16_FROM_LE(x): x); + return (guint64)ltt_get_uint16(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 4){ - guint32 x = *(guint32 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (guint64) (revFlag ? GUINT32_FROM_BE(x): x); - else - return (guint64) (revFlag ? GUINT32_FROM_LE(x): x); + return (guint64)ltt_get_uint32(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 8){ - guint64 x = *(guint64 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (guint64) (revFlag ? GUINT64_FROM_BE(x): x); - else - return (guint64) (revFlag ? GUINT64_FROM_LE(x): x); + return ltt_get_uint64(reverse_byte_order, e->data + f->offset_root); } g_critical("ltt_event_get_long_unsigned : field size %i unknown", f->field_size); return 0; @@ -657,8 +638,9 @@ guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f) gint64 ltt_event_get_long_int(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; g_assert( f->field_type->type_class == LTT_INT); @@ -666,23 +648,11 @@ gint64 ltt_event_get_long_int(LttEvent *e, LttField *f) gint8 x = *(gint8 *)(e->data + f->offset_root); return (gint64) x; }else if(f->field_size == 2){ - gint16 x = *(gint16 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (gint64) (revFlag ? GINT16_FROM_BE(x): x); - else - return (gint64) (revFlag ? GINT16_FROM_LE(x): x); + return (gint64)ltt_get_int16(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 4){ - gint32 x = *(gint32 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (gint64) (revFlag ? GINT32_FROM_BE(x): x); - else - return (gint64) (revFlag ? GINT32_FROM_LE(x): x); + return (gint64)ltt_get_int32(reverse_byte_order, e->data + f->offset_root); }else if(f->field_size == 8){ - gint64 x = *(gint64 *)(e->data + f->offset_root); - if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN) - return (gint64) (revFlag ? GINT64_FROM_BE(x): x); - else - return (gint64) (revFlag ? GINT64_FROM_LE(x): x); + return ltt_get_int64(reverse_byte_order, e->data + f->offset_root); } g_critical("ltt_event_get_long_int : field size %i unknown", f->field_size); return 0; @@ -690,12 +660,13 @@ gint64 ltt_event_get_long_int(LttEvent *e, LttField *f) float ltt_event_get_float(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4); - if(revFlag == 0) return *(float *)(e->data + f->offset_root); + if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root); else{ guint32 aInt; memcpy((void*)&aInt, e->data + f->offset_root, 4); @@ -706,12 +677,13 @@ float ltt_event_get_float(LttEvent *e, LttField *f) double ltt_event_get_double(LttEvent *e, LttField *f) { - int revFlag = e->tracefile->trace->my_arch_endian == - e->tracefile->trace->system_description->endian ? 0:1; + gboolean reverse_byte_order = e->tracefile->trace->reverse_byte_order; + //int revFlag = e->tracefile->trace->my_arch_endian == + // e->tracefile->trace->system_description->endian ? 0:1; g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8); - if(revFlag == 0) return *(double *)(e->data + f->offset_root); + if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root); else{ guint64 aInt; memcpy((void*)&aInt, e->data + f->offset_root, 8); diff --git a/ltt/branches/poly/ltt/ltt-types.h b/ltt/branches/poly/ltt/ltt-types.h index a1701874..0d8b5406 100644 --- a/ltt/branches/poly/ltt/ltt-types.h +++ b/ltt/branches/poly/ltt/ltt-types.h @@ -23,8 +23,9 @@ * */ #include -#include +//#include #include +#include /***************************************************************************** @@ -39,35 +40,52 @@ * ****************************************************************************/ -inline gint64 ltt_get_int64(LttTrace t, void *ptr) +static inline gint64 ltt_get_int64(gboolean reverse_byte_order, void *ptr) { - return (gint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); + guint64 value = *(guint64*)ptr; + return (gint64) (reverse_byte_order ? GUINT64_SWAP_LE_BE(value): value); } -inline guint64 ltt_get_uint64(LttTrace t, void *ptr) +static inline guint64 ltt_get_uint64(gboolean reverse_byte_order, void *ptr) { - return (guint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); + guint64 value = *(guint64*)ptr; + return (guint64) (reverse_byte_order ? GUINT64_SWAP_LE_BE(value): value); } -inline gint32 ltt_get_int32(LttTrace t, void *ptr) +static inline gint32 ltt_get_int32(gboolean reverse_byte_order, void *ptr) { - return (gint32) (t->reverse_byte_order ? GUINT32_SWAP_LE_BE(ptr): ptr); + guint32 value = *(guint32*)ptr; + return (gint32) (reverse_byte_order ? GUINT32_SWAP_LE_BE(value): value); } -inline guint32 ltt_get_uint32(LttTrace t, void *ptr) +static inline guint32 ltt_get_uint32(gboolean reverse_byte_order, void *ptr) { - return (guint32) (t->reverse_byte_order ? GUINT32_SWAP_LE_BE(ptr): ptr); + guint32 value = *(guint32*)ptr; + return (guint32) (reverse_byte_order ? GUINT32_SWAP_LE_BE(value): value); } -inline gint16 ltt_get_int16(LttTrace t, void *ptr) +static inline gint16 ltt_get_int16(gboolean reverse_byte_order, void *ptr) { - return (gint16) (t->reverse_byte_order ? GUINT16_SWAP_LE_BE(ptr): ptr); + guint16 value = *(guint16*)ptr; + return (gint16) (reverse_byte_order ? GUINT16_SWAP_LE_BE(value): value); } -inline guint16 ltt_get_uint16(LttTrace t, void *ptr) +static inline guint16 ltt_get_uint16(gboolean reverse_byte_order, void *ptr) { - return (guint16) (t->reverse_byte_order ? GUINT16_SWAP_LE_BE(ptr): ptr); + guint16 value = *(guint16*)ptr; + return (guint16) (reverse_byte_order ? GUINT16_SWAP_LE_BE(value): value); +} + +static inline LttTime ltt_get_time(gboolean reverse_byte_order, void *ptr) +{ + LttTime output; + + output.tv_sec = ltt_get_uint64(reverse_byte_order, ptr); + ptr += sizeof(guint64); + output.tv_nsec = ltt_get_uint64(reverse_byte_order, ptr); + + return output; } #endif // LTT_TYPES_H diff --git a/ltt/branches/poly/ltt/ltt.h b/ltt/branches/poly/ltt/ltt.h index 3af7cd32..5651702c 100644 --- a/ltt/branches/poly/ltt/ltt.h +++ b/ltt/branches/poly/ltt/ltt.h @@ -87,7 +87,7 @@ typedef struct _LttSystemDescription LttSystemDescription; /* Checksums are used to differentiate facilities which have the same name but differ. */ -typedef unsigned long LttChecksum; +typedef guint32 LttChecksum; /* Events are usually stored with the easily obtained CPU clock cycle count, diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index bee3b5f9..58a6a10e 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -37,7 +37,8 @@ This program is distributed in the hope that it will be useful, #include #include #include -#include +#include +#include #include "parser.h" @@ -912,7 +913,7 @@ int checkNamedTypesImplemented(table * named_types) * checksum : checksum for the facility ****************************************************************************/ -int generateChecksum(char* facName, unsigned long * checksum, sequence * events) +int generateChecksum(char* facName, guint32 * checksum, sequence * events) { unsigned long crc ; int pos; diff --git a/ltt/branches/poly/ltt/parser.h b/ltt/branches/poly/ltt/parser.h index 37dd38bb..1d56d462 100644 --- a/ltt/branches/poly/ltt/parser.h +++ b/ltt/branches/poly/ltt/parser.h @@ -22,6 +22,8 @@ This program is distributed in the hope that it will be useful, #ifndef PARSER_H #define PARSER_H +#include + /* Extensible array container */ typedef struct _sequence { @@ -159,7 +161,7 @@ type_descriptor *parseType(parse_file *in, type_descriptor *t, sequence * unname void parseFields(parse_file *in, type_descriptor *t, sequence * unnamed_types, table * named_types); int checkNamedTypesImplemented(table * namedTypes); type_descriptor * find_named_type(char *name, table * named_types); -int generateChecksum(char * facName, unsigned long * checksum, sequence * events); +int generateChecksum(char * facName, guint32 * checksum, sequence * events); /* get attributes */ diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index 7d925d1b..d826e4ac 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -23,8 +23,6 @@ #include #include -#include - typedef struct _LttTime { unsigned long tv_sec; unsigned long tv_nsec; @@ -248,17 +246,4 @@ static inline LttTime ltt_time_from_uint64(guint64 t1) return res; } -inline LttTime ltt_get_time(LttTrace t, void *ptr) -{ - LttTime output; - - output.tv_sec = - (guint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); - ptr += sizeof(guint64); - output.tv_nsec = - (guint64) (t->reverse_byte_order ? GUINT64_SWAP_LE_BE(ptr): ptr); - - return output; -} - #endif // LTT_TIME_H diff --git a/ltt/branches/poly/ltt/trace.h b/ltt/branches/poly/ltt/trace.h index 96931524..9981f1f0 100644 --- a/ltt/branches/poly/ltt/trace.h +++ b/ltt/branches/poly/ltt/trace.h @@ -146,7 +146,7 @@ void getDataEndianType(LttArchSize * size, LttArchEndian * endian); /* get an integer number */ -gint64 getIntNumber(int size1, void *evD); +gint64 getIntNumber(gboolean reverse_byte_order, int size1, void *evD); /* get the node name of the system */ diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index ec34fbf6..0290b59d 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -523,11 +523,11 @@ LttTrace *ltt_trace_open(const char *pathname) /* Set the reverse byte order between trace and reader */ if(sys_description->endian == LTT_LITTLE_ENDIAN && G_BYTE_ORDER != G_LITTLE_ENDIAN) { - t->reverse_byte_order = true; + t->reverse_byte_order = 1; } else if(sys_description->endian == LTT_BIG_ENDIAN && G_BYTE_ORDER != G_BIG_ENDIAN) { - t->reverse_byte_order = true; - } else t->reverse_byte_order = false; + t->reverse_byte_order = 1; + } else t->reverse_byte_order = 0; //get facilities info if(getFacilityInfo(t,eventdefs)) { @@ -1086,14 +1086,14 @@ LttEvent *ltt_tracefile_read(LttTracefile *t, LttEvent *event) if(unlikely(err))g_error("Can not read tracefile"); } - event->event_id = ltt_get_uint16(t, t->cur_event_pos); + event->event_id = ltt_get_uint16(t->trace->reverse_byte_order, t->cur_event_pos); if(unlikely(event->event_id == TRACE_TIME_HEARTBEAT)) t->cur_heart_beat_number++; t->prev_event_time = t->current_event_time; // t->current_event_time = getEventTime(t); - event->time_delta = ltt_get_uint32(t, t->cur_event_pos + EVENT_ID_SIZE); + event->time_delta = ltt_get_uint32(t->trace->reverse_byte_order, t->cur_event_pos + EVENT_ID_SIZE); event->event_time = t->current_event_time; event->event_cycle_count = t->cur_cycle_count; @@ -1204,13 +1204,14 @@ int readBlock(LttTracefile * tf, int whichBlock) /* read the whole block to precalculate total of cycles in it */ tf->count = 0; tf->pre_cycle_count = 0; - tf->cur_cycle_count = ltt_get_uint32(tf, tf->cur_event_pos + EVENT_ID_SIZE); + tf->cur_cycle_count = ltt_get_uint32(tf->trace->reverse_byte_order, tf->cur_event_pos + EVENT_ID_SIZE); getCyclePerNsec(tf); tf->overflow_nsec = (-((double) - (ltt_get_uint32(tf, tf->a_block_start->cycle_count)&0xFFFFFFFF)) + (ltt_get_uint32(tf->trace->reverse_byte_order, + &tf->a_block_start->cycle_count)&0xFFFFFFFF)) * tf->nsec_per_cycle); tf->current_event_time = getEventTime(tf); @@ -1238,7 +1239,8 @@ void updateTracefile(LttTracefile * tf) tf->count = 0; tf->overflow_nsec = - (-((double)ltt_get_uint32(tf, tf->a_block_start->cycle_count)) + (-((double)ltt_get_uint32(tf->trace->reverse_byte_order, + &tf->a_block_start->cycle_count)) * tf->nsec_per_cycle); } @@ -1260,7 +1262,7 @@ int skipEvent(LttTracefile * t) LttEventType * evT; LttField * rootFld; - evId = ltt_get_uint16(t, t->cur_event_pos); + evId = ltt_get_uint16(t->trace->reverse_byte_order, t->cur_event_pos); evData = t->cur_event_pos + EVENT_HEADER_SIZE; evT = ltt_trace_eventtype_get(t->trace,(unsigned)evId); @@ -1284,7 +1286,8 @@ int skipEvent(LttTracefile * t) if(unlikely(evId == TRACE_BLOCK_END)){ t->cur_event_pos = t->buffer + t->block_size; }else{ - t->cur_cycle_count = ltt_get_uint32(t, t->cur_event_pos + EVENT_ID_SIZE); + t->cur_cycle_count = ltt_get_uint32(t->trace->reverse_byte_order, + t->cur_event_pos + EVENT_ID_SIZE); t->which_event++; t->current_event_time = getEventTime(t); } @@ -1312,8 +1315,10 @@ void getCyclePerNsec(LttTracefile * t) lBufTotalTime = ltt_time_sub(t->a_block_end->time, t->a_block_start->time); /* Calculate the total cycles for this bufffer */ - lBufTotalCycle = ltt_get_uint32(t, t->a_block_end->cycle_count); - lBufTotalCycle -= ltt_get_uint32(t, t->a_block_start->cycle_count); + lBufTotalCycle = ltt_get_uint32(t->trace->reverse_byte_order, + &t->a_block_end->cycle_count); + lBufTotalCycle -= ltt_get_uint32(t->trace->reverse_byte_order, + &t->a_block_start->cycle_count); /* Convert the total time to double */ lBufTotalNSec = ltt_time_to_double(lBufTotalTime); @@ -1344,9 +1349,11 @@ static inline LttTime getEventTime(LttTracefile * tf) LttTime lTimeOffset; // Time offset in struct LttTime guint16 evId; - evId = ltt_get_uint16(tf, tf->cur_event_pos); + evId = ltt_get_uint16(tf->trace->reverse_byte_order, + tf->cur_event_pos); - cycle_count = ltt_get_uint32(tf, tf->cur_event_pos + EVENT_ID_SIZE); + cycle_count = ltt_get_uint32(tf->trace->reverse_byte_order, + tf->cur_event_pos + EVENT_ID_SIZE); gboolean comp_count = cycle_count < tf->pre_cycle_count; @@ -1362,8 +1369,10 @@ static inline LttTime getEventTime(LttTracefile * tf) lEventNSec = 0; } else if(unlikely(evId == TRACE_BLOCK_END)) { lEventNSec = ((double) - (ltt_get_uint32(tf, tf->a_block_end->cycle_count) - - ltt_get_uint32(tf, tf->a_block_start->cycle_count)) + (ltt_get_uint32(tf->trace->reverse_byte_order, + &tf->a_block_end->cycle_count) + - ltt_get_uint32(tf->trace->reverse_byte_order, + &tf->a_block_start->cycle_count)) * tf->nsec_per_cycle); } #if 0 @@ -1480,7 +1489,7 @@ static inline gint getFieldtypeSize(LttTracefile * t, 0,fld->child[0], NULL, trace); fld->element_size = size; }else{//0: sequence - element_number = getIntNumber(t,size1,evD); + element_number = getIntNumber(t->trace->reverse_byte_order,size1,evD); type->element_number = element_number; if(fld->element_size > 0){ size = element_number * fld->element_size; @@ -1589,23 +1598,23 @@ end_getFieldtypeSize: * gint64 : a 64 bits integer ****************************************************************************/ -gint64 getIntNumber(LttTracefile * t, int size, void *evD) +gint64 getIntNumber(gboolean reverse_byte_order, int size, void *evD) { gint64 i; switch(size) { case 1: i = *((gint8*)evD); break; - case 2: i = ltt_get_int16(t, evD); break; - case 4: i = ltt_get_int32(t, evD); break; - case 8: i = ltt_get_int64(t, evD); break; - default: i = ltt_get_int64(t, evD); + case 2: i = ltt_get_int16(reverse_byte_order, evD); break; + case 4: i = ltt_get_int32(reverse_byte_order, evD); break; + case 8: i = ltt_get_int64(reverse_byte_order, evD); break; + default: i = ltt_get_int64(reverse_byte_order, evD); g_critical("getIntNumber : integer size %d unknown", size); break; } return i; } - +#if 0 /***************************************************************************** *Function name * getDataEndianType : get the data type size and endian type of the local @@ -1634,7 +1643,7 @@ void getDataEndianType(LttArchSize * size, LttArchEndian * endian) *size = LTT_ILP64; else *size = LTT_UNKNOWN; } - +#endif //0 /* get the node name of the system */ char * ltt_trace_system_description_node_name (LttSystemDescription * s)