+++ /dev/null
-/*
- * LTTTypes.h
- *
- * Copyright (C) 2000 Karim Yaghmour (karym@opersys.com).
- *
- * This is distributed under GPL.
- *
- * Header for LTT-secific types.
- *
- * History :
- * K.Y. 07/09/2001, Added David Schleef's architecture independent ltt_set_bit/ltt_clear_bit/ltt_test_bit
- * JAL, 05/01/2001, Modified PPC bit manipulation functions for x86 compatibility.
- * (andy_lowe@mvista.com)
- * K.Y., 31/05/2000, Initial typing.
- */
-
-#ifndef __TRACE_TOOLKIT_TYPES_HEADER__
-#define __TRACE_TOOLKIT_TYPES_HEADER__
-
-#include <sys/types.h>
-#include <sys/time.h>
-
-#if defined(sun)
-
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-#ifdef _LP64
-typedef unsigned long u_int64_t;
-#else /* _ILP32 */
-#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
-typedef unsigned long long u_int64_t;
-#endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */
-#endif /* _LP64 */
-
-#endif /* defined(sun) */
-
-extern __inline__ int ltt_set_bit(int nr, void * addr)
-{
- unsigned char *p = addr;
- unsigned char mask = 1 << (nr&7);
- unsigned char old;
-
- p += nr>>3;
- old = *p;
- *p |= mask;
-
- return ((old & mask) != 0);
-}
-
-extern __inline__ int ltt_clear_bit(int nr, void * addr)
-{
- unsigned char *p = addr;
- unsigned char mask = 1 << (nr&7);
- unsigned char old;
-
- p += nr>>3;
- old = *p;
- *p &= ~mask;
-
- return ((old & mask) != 0);
-}
-
-extern __inline__ int ltt_test_bit(int nr,void *addr)
-{
- unsigned char *p = addr;
- unsigned char mask = 1 << (nr&7);
-
- p += nr>>3;
-
- return ((*p & mask) != 0);
-}
-
-/* Big-endian/little-endian conversion macros for cross-development. */
-#if TARGET_NATIVE
-/* For native development, these conversion macros aren't needed. */
-#define BREV16(x) (x)
-#define BREV32(x) (x)
-#define BREV64(x) (x)
-#define RFT8(db,x) (x)
-#define RFT16(db,x) (x)
-#define RFT32(db,x) (x)
-#define RFT64(db,x) (x)
-
-/* Non-native development */
-#else
- /* BREV16: byte-reverse a 16-bit integer */
-#define BREV16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
- /* BREV32: byte-reverse a 32-bit integer */
-#define BREV32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
- | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
- /* BREV64: byte-reverse a 64-bit integer */
-#define BREV64(x) ((((x) & 0xff00000000000000) >> 56) \
- | (((x) & 0x00ff000000000000) >> 40) \
- | (((x) & 0x0000ff0000000000) >> 24) \
- | (((x) & 0x000000ff00000000) >> 8) \
- | (((x) & 0x00000000ff000000) << 8) \
- | (((x) & 0x0000000000ff0000) << 24) \
- | (((x) & 0x000000000000ff00) << 40) \
- | (((x) & 0x00000000000000ff) << 56))
- /* RFTn: Read From Trace
- * Conditionally byte-reverse an 8-, 16-, 32-, or 64-bit integer
- * based on the value of the ByteRev member of the trace database
- * structure pointer passed as the first argument..
- */
-#define RFT8(db,x) (x)
-#define RFT16(db,x) ((db)->ByteRev ? BREV16(x) : (x))
-#define RFT32(db,x) ((db)->ByteRev ? BREV32(x) : (x))
-#define RFT64(db,x) ((db)->ByteRev ? BREV64(x) : (x))
-#endif /* TRACE_TARGET_NATIVE */
-
-#if !defined(sun)
-/* Some type corrections, just in case */
-#ifndef uint8_t
-#define uint8_t u_int8_t
-#endif
-#ifndef uint16_t
-#define uint16_t u_int16_t
-#endif
-#ifndef uint32_t
-#define uint32_t u_int32_t
-#endif
-#ifndef uint64_t
-#define uint64_t u_int64_t
-#endif
-#endif /* !defined(sun) */
-
-/* Structure packing */
-#if LTT_UNPACKED_STRUCTS
-#define LTT_PACKED_STRUCT
-#else
-#define LTT_PACKED_STRUCT __attribute__ ((packed))
-#endif /* UNPACKED_STRUCTS */
-
-/* Trace mask */
-typedef uint64_t trace_event_mask;
-
-/* Boolean stuff */ /* Now in glib */
-//#define TRUE 1
-//#define FALSE 0
-
-#endif /* __TRACE_TOOLKIT_TYPES_HEADER__ */
lttinclude_HEADERS = \
- LTTTypes.h\
event.h\
facility.h\
ltt-private.h\
#define LTT_PRIVATE_H
#include <glib.h>
+#include <sys/types.h>
#include <ltt/ltt.h>
-#include <ltt/LTTTypes.h>
#include <ltt/type.h>
#include <ltt/trace.h>
+#define LTT_PACKED_STRUCT __attribute__ ((packed))
+
/* enumeration definition */
typedef enum _BuildinEvent{
typedef struct _FacilityLoad{
char * name;
LttChecksum checksum;
- uint32_t base_code;
+ guint32 base_code;
} LTT_PACKED_STRUCT FacilityLoad;
typedef struct _BlockStart {
LttTime time; //Time stamp of this block
LttCycleCount cycle_count; //cycle count of the event
- uint32_t block_id; //block id
+ guint32 block_id; //block id
} LTT_PACKED_STRUCT BlockStart;
typedef struct _BlockEnd {
LttTime time; //Time stamp of this block
LttCycleCount cycle_count; //cycle count of the event
- uint32_t block_id; //block id
+ guint32 block_id; //block id
} LTT_PACKED_STRUCT BlockEnd;
typedef struct _TimeHeartbeat {
};
struct _LttEvent{
- uint16_t event_id;
- uint32_t time_delta;
+ guint16 event_id;
+ guint32 time_delta;
LttTime event_time;
LttCycleCount event_cycle_count;
LttTracefile * tracefile;
char * name; //facility name
int event_number; //number of events in the facility
LttChecksum checksum; //checksum of the facility
- uint32_t base_id; //base id of the facility
+ guint32 base_id; //base id of the facility
LttEventType ** events; //array of event types
LttType ** named_types;
int named_types_number;
/*****************************************************************************
macro for size of some data types
*****************************************************************************/
-#define EVENT_ID_SIZE sizeof(uint16_t)
-#define TIME_DELTA_SIZE sizeof(uint32_t)
+#define EVENT_ID_SIZE sizeof(guint16)
+#define TIME_DELTA_SIZE sizeof(guint32)
#define EVENT_HEADER_SIZE (EVENT_ID_SIZE + TIME_DELTA_SIZE)
#define LTT_H
#include <ltt/time.h>
-#include <ltt/LTTTypes.h>
+#include <glib.h>
/* A trace is associated with a tracing session run on a single, possibly
multi-cpu, system. It is defined as a pathname to a directory containing
} TimeInterval;
-typedef uint64_t LttCycleCount;
+typedef guint64 LttCycleCount;
/* Event positions are used to seek within a tracefile based on
#include <stdio.h>
#include <asm/types.h>
#include <linux/byteorder/swab.h>
-#include <ltt/LTTTypes.h>
#include "parser.h"
#include <ltt/event.h>
g_error("The type of the field is not unsigned int\n");
if(f->field_size == 1){
- uint8_t x = *(uint8_t*)(e->data + f->offset_root);
+ guint8 x = *(guint8 *)(e->data + f->offset_root);
return (unsigned int) x;
}else if(f->field_size == 2){
- uint16_t x = *(uint16_t*)(e->data + f->offset_root);
- return (unsigned int) (revFlag ? BREV16(x): x);
+ guint16 x = *(guint16 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned int) (revFlag ? GUINT16_FROM_BE(x): x);
+ else
+ return (unsigned int) (revFlag ? GUINT16_FROM_LE(x): x);
}else if(f->field_size == 4){
- uint32_t x = *(uint32_t*)(e->data + f->offset_root);
- return (unsigned int) (revFlag ? BREV32(x): x);
+ guint32 x = *(guint32 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned int) (revFlag ? GUINT32_FROM_BE(x): x);
+ else
+ return (unsigned int) (revFlag ? GUINT32_FROM_LE(x): x);
}else if(f->field_size == 8){
- uint64_t x = *(uint64_t*)(e->data + f->offset_root);
- return (unsigned int) (revFlag ? BREV64(x): x);
+ guint64 x = *(guint64 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned int) (revFlag ? GUINT64_FROM_BE(x): x);
+ else
+ return (unsigned int) (revFlag ? GUINT64_FROM_LE(x): x);
}
}
g_error("The type of the field is not int\n");
if(f->field_size == 1){
- int8_t x = *(int8_t*)(e->data + f->offset_root);
+ gint8 x = *(gint8 *)(e->data + f->offset_root);
return (int) x;
}else if(f->field_size == 2){
- int16_t x = *(int16_t*)(e->data + f->offset_root);
- return (int) (revFlag ? BREV16(x): x);
+ gint16 x = *(gint16 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (int) (revFlag ? GINT16_FROM_BE(x): x);
+ else
+ return (int) (revFlag ? GINT16_FROM_LE(x): x);
}else if(f->field_size == 4){
- int32_t x = *(int32_t*)(e->data + f->offset_root);
- return (int) (revFlag ? BREV32(x): x);
+ gint32 x = *(gint32 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (int) (revFlag ? GINT32_FROM_BE(x): x);
+ else
+ return (int) (revFlag ? GINT32_FROM_LE(x): x);
}else if(f->field_size == 8){
- int64_t x = *(int64_t*)(e->data + f->offset_root);
- return (int) (revFlag ? BREV64(x): x);
+ gint64 x = *(gint64 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (int) (revFlag ? GINT64_FROM_BE(x): x);
+ else
+ return (int) (revFlag ? GINT64_FROM_LE(x): x);
}
}
g_error("The type of the field is not unsigned long\n");
if(f->field_size == 1){
- uint8_t x = *(uint8_t*)(e->data + f->offset_root);
+ guint8 x = *(guint8 *)(e->data + f->offset_root);
return (unsigned long) x;
}else if(f->field_size == 2){
- uint16_t x = *(uint16_t*)(e->data + f->offset_root);
- return (unsigned long) (revFlag ? BREV16(x): x);
+ guint16 x = *(guint16 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned long) (revFlag ? GUINT16_FROM_BE(x): x);
+ else
+ return (unsigned long) (revFlag ? GUINT16_FROM_LE(x): x);
}else if(f->field_size == 4){
- uint32_t x = *(uint32_t*)(e->data + f->offset_root);
- return (unsigned long) (revFlag ? BREV32(x): x);
+ guint32 x = *(guint32 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned long) (revFlag ? GUINT32_FROM_BE(x): x);
+ else
+ return (unsigned long) (revFlag ? GUINT32_FROM_LE(x): x);
}else if(f->field_size == 8){
- uint64_t x = *(uint64_t*)(e->data + f->offset_root);
- return (unsigned long) (revFlag ? BREV64(x): x);
+ guint64 x = *(guint64 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (unsigned long) (revFlag ? GUINT64_FROM_BE(x): x);
+ else
+ return (unsigned long) (revFlag ? GUINT64_FROM_LE(x): x);
}
}
g_error("The type of the field is not long int\n");
if(f->field_size == 1){
- int8_t x = *(int8_t*)(e->data + f->offset_root);
+ gint8 x = *(gint8 *)(e->data + f->offset_root);
return (long) x;
}else if(f->field_size == 2){
- int16_t x = *(int16_t*)(e->data + f->offset_root);
- return (long) (revFlag ? BREV16(x): x);
+ gint16 x = *(gint16 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (long) (revFlag ? GINT16_FROM_BE(x): x);
+ else
+ return (long) (revFlag ? GINT16_FROM_LE(x): x);
}else if(f->field_size == 4){
- int32_t x = *(int32_t*)(e->data + f->offset_root);
- return (long) (revFlag ? BREV32(x): x);
+ gint32 x = *(gint32 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (long) (revFlag ? GINT32_FROM_BE(x): x);
+ else
+ return (long) (revFlag ? GINT32_FROM_LE(x): x);
}else if(f->field_size == 8){
- int64_t x = *(int64_t*)(e->data + f->offset_root);
- return (long) (revFlag ? BREV64(x): x);
+ gint64 x = *(gint64 *)(e->data + f->offset_root);
+ if(e->tracefile->trace->my_arch_endian == LTT_LITTLE_ENDIAN)
+ return (long) (revFlag ? GINT64_FROM_BE(x): x);
+ else
+ return (long) (revFlag ? GINT64_FROM_LE(x): x);
}
}
if(revFlag == 0) return *(float *)(e->data + f->offset_root);
else{
- uint32_t aInt;
+ guint32 aInt;
memcpy((void*)&aInt, e->data + f->offset_root, 4);
aInt = ___swab32(aInt);
return *((float*)&aInt);
if(revFlag == 0) return *(double *)(e->data + f->offset_root);
else{
- uint64_t aInt;
+ guint64 aInt;
memcpy((void*)&aInt, e->data + f->offset_root, 8);
aInt = ___swab64(aInt);
return *((double *)&aInt);
#include <string.h>
#include <stdio.h>
-#include <ltt/LTTTypes.h>
#include "parser.h"
#include <ltt/facility.h>
#include <dirent.h>
#include <linux/errno.h>
-#include <ltt/LTTTypes.h>
#include "parser.h"
#include <ltt/trace.h>
LttTracefile * tf;
LttEvent * ev;
LttFacility * f;
- uint16_t evId;
+ guint16 evId;
void * pos;
FacilityLoad fLoad;
int i;
pos = ev->data;
fLoad.name = (char*)pos;
fLoad.checksum = *(LttChecksum*)(pos + strlen(fLoad.name));
- fLoad.base_code = *(uint32_t*)(pos + strlen(fLoad.name) + sizeof(LttChecksum));
+ fLoad.base_code = *(guint32 *)(pos + strlen(fLoad.name) + sizeof(LttChecksum));
for(i=0;i<t->facility_number;i++){
f = (LttFacility*)g_ptr_array_index(t->facilities,i);
if(err)g_error("Can not read tracefile");
}
- lttEvent->event_id = (int)(*(uint16_t *)(t->cur_event_pos));
+ lttEvent->event_id = (int)(*(guint16 *)(t->cur_event_pos));
if(lttEvent->event_id == TRACE_TIME_HEARTBEAT)
t->cur_heart_beat_number++;
t->prev_event_time = t->current_event_time;
// t->current_event_time = getEventTime(t);
- lttEvent->time_delta = *(uint32_t*)(t->cur_event_pos + EVENT_ID_SIZE);
+ lttEvent->time_delta = *(guint32 *)(t->cur_event_pos + EVENT_ID_SIZE);
lttEvent->event_time = t->current_event_time;
lttEvent->tracefile = t;
int readBlock(LttTracefile * tf, int whichBlock)
{
off_t nbBytes;
- uint32_t lostSize;
+ guint32 lostSize;
if(whichBlock - tf->which_block == 1 && tf->which_block != 0){
tf->prev_block_end_time = tf->a_block_end->time;
return EIO;
tf->a_block_start=(BlockStart *) (tf->buffer + EVENT_HEADER_SIZE);
- lostSize = *(uint32_t*)(tf->buffer + tf->block_size - sizeof(uint32_t));
+ lostSize = *(guint32 *)(tf->buffer + tf->block_size - sizeof(guint32));
tf->a_block_end=(BlockEnd *)(tf->buffer + tf->block_size -
lostSize + EVENT_HEADER_SIZE);
tf->last_event_pos = tf->buffer + tf->block_size - lostSize;
LttEventType * evT;
LttField * rootFld;
- evId = (int)(*(uint16_t *)(t->cur_event_pos));
+ evId = (int)(*(guint16 *)(t->cur_event_pos));
evData = t->cur_event_pos + EVENT_HEADER_SIZE;
evT = ltt_trace_eventtype_get(t->trace,(unsigned)evId);
LttCycleCount lEventTotalCycle; // Total cycles from start for event
double lEventNSec; // Total usecs from start for event
LttTime lTimeOffset; // Time offset in struct LttTime
- uint16_t evId;
- int64_t nanoSec, tmpCycleCount = (((uint64_t)1)<<32);
+ guint16 evId;
+ gint64 nanoSec, tmpCycleCount = (((guint64)1)<<32);
static LttCycleCount preCycleCount = 0;
static int count = 0;
- evId = *(uint16_t*)tf->cur_event_pos;
+ evId = *(guint16 *)tf->cur_event_pos;
if(evId == TRACE_BLOCK_START){
count = 0;
preCycleCount = 0;
}
// Calculate total time in cycles from start of buffer for this event
- cycle_count = (LttCycleCount)*(uint32_t*)(tf->cur_event_pos + EVENT_ID_SIZE);
+ cycle_count = (LttCycleCount)*(guint32 *)(tf->cur_event_pos + EVENT_ID_SIZE);
if(cycle_count < preCycleCount)count++;
preCycleCount = cycle_count;
int getIntNumber(int size, void *evD)
{
- int64_t i;
- if(size == 1) i = *(int8_t *)evD;
- else if(size == 2) i = *(int16_t *)evD;
- else if(size == 4) i = *(int32_t *)evD;
- else if(size == 8) i = *(int64_t *)evD;
+ gint64 i;
+ if(size == 1) i = *(gint8 *)evD;
+ else if(size == 2) i = *(gint16 *)evD;
+ else if(size == 4) i = *(gint32 *)evD;
+ else if(size == 8) i = *(gint64 *)evD;
return (int) i;
}
#include <stdio.h>
-#include <ltt/LTTTypes.h>
#include "parser.h"
#include <ltt/type.h>
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
event_viewer_data->current_time = *(LttTime*)call_data;
- uint64_t nsec = event_viewer_data->current_time.tv_sec * NANOSECONDS_PER_SECOND
+ guint64 nsec = event_viewer_data->current_time.tv_sec * NANOSECONDS_PER_SECOND
+ event_viewer_data->current_time.tv_nsec;
GtkTreeIter iter;
- uint64_t time;
+ guint64 time;
int count = 0;
GtkTreeModel* model = (GtkTreeModel*)event_viewer_data->store_m;