double and float fix
[lttv.git] / ltt / branches / poly / ltt / ltt-private.h
index 409d05622026df17c5267c1e6683639398c3bdd4..6a0c4578efda332180f68a944eb777881d4ddf3c 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <sys/types.h>
 #include <ltt/ltt.h>
+#include <endian.h>
 
 
 #ifndef max
 
 /* Hardcoded facilities */
 #define LTT_FACILITY_CORE 0
+/* Byte ordering */
+#define LTT_GET_BO(t) ((t)->reverse_bo)
+
+#define LTT_HAS_FLOAT(t) ((t)->float_word_order!=0)
+#define LTT_GET_FLOAT_BO(t) \
+  (((t)->float_word_order==__BYTE_ORDER)?0:1)
+
 
 /* Hardcoded core events */
 enum ltt_core_events {
     LTT_EVENT_FACILITY_LOAD,
     LTT_EVENT_FACILITY_UNLOAD,
-    LTT_EVENT_STATE_DUMP_FACILITY_LOAD,
-    LTT_EVENT_HEARTBEAT
+    LTT_EVENT_HEARTBEAT,
+    LTT_EVENT_STATE_DUMP_FACILITY_LOAD
 };
 
 
@@ -128,21 +137,42 @@ struct ltt_event_header_nohb {
   uint16_t      event_size;
 } LTT_PACKED_STRUCT;
 
-struct ltt_trace_header {
+
+/* Block and trace headers */
+
+struct ltt_trace_header_any {
+  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;
+} LTT_PACKED_STRUCT;
+
+
+/* For version 0.3 */
+
+struct ltt_trace_header_0_3 {
   uint32_t        magic_number;
   uint32_t        arch_type;
   uint32_t        arch_variant;
+  uint32_t        float_word_order;
   uint8_t         arch_size;
-  //uint32_t        system_type;
-  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;
+  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;
 } LTT_PACKED_STRUCT;
 
 
+
 struct ltt_block_start_header {
   struct { 
     struct timeval          timestamp;
@@ -154,10 +184,14 @@ struct ltt_block_start_header {
   } end;
   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;
+  char                    trace[0];
 } LTT_PACKED_STRUCT;
 
 
+
+
+
+
 struct _LttType{
   GQuark type_name;                //type name if it is a named type
   GQuark element_name;             //elements name of the struct
@@ -204,6 +238,8 @@ struct _LttEvent{
 
   void * data;               //event data
   guint  data_size;
+  guint  event_size;         //event_size field of the header : 
+                             //used to verify data_size from facility.
 
   int      count;                    //the number of overflow of cycle count
   gint64 overflow_nsec;              //precalculated nsec for overflows
@@ -266,6 +302,7 @@ struct _LttFacility{
   guint32  id;          //id of the facility
  
   guint32 pointer_size;
+  guint32 long_size;
   guint32 size_t_size;
   guint32 alignment;
 
@@ -305,14 +342,16 @@ typedef struct _LttBuffer {
 
 struct _LttTracefile{
   gboolean cpu_online;               //is the cpu online ?
+  GQuark long_name;                  //tracefile complete filename
   GQuark name;                       //tracefile name
   guint cpu_num;                     //cpu number of the tracefile
   LttTrace * trace;                  //trace containing the tracefile
   int fd;                            //file descriptor 
   off_t file_size;                   //file size
-  unsigned block_size;               //block_size
+  //unsigned block_size;               //block_size
   unsigned int num_blocks;           //number of blocks in the file
   gboolean  reverse_bo;              //must we reverse byte order ?
+  gboolean  float_word_order;        //what is the byte order of floats ?
 
        /* Current event */
   LttEvent event;                    //Event currently accessible in the trace
@@ -341,7 +380,8 @@ struct _LttTrace{
   GArray *facilities_by_num;            /* fac_id as index in array */
   GData *facilities_by_name;            /* fac name (GQuark) as index */
                                         /* Points to array of fac_id of all the
-                                         * facilities that has this name. */
+                                        * facilities that has this name. */
+  guint     num_cpu;
 
   guint32   arch_type;
   guint32   arch_variant;
@@ -386,7 +426,5 @@ struct _LttSystemDescription {
 //#define EVENT_ID_SIZE     sizeof(guint16)
 //#define EVENT_HEADER_SIZE (TIMESTAMP_SIZE + EVENT_ID_SIZE)
 
-#define LTT_GET_BO(t) ((t)->reverse_bo)
-
 
 #endif /* LTT_PRIVATE_H */
This page took 0.02589 seconds and 4 git commands to generate.