first version of header files
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 30 May 2003 19:15:53 +0000 (19:15 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 30 May 2003 19:15:53 +0000 (19:15 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@59 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/include/ltt/event.h
ltt/branches/poly/include/ltt/facility.h
ltt/branches/poly/include/ltt/ltt-private.h [new file with mode: 0644]
ltt/branches/poly/include/ltt/ltt.h
ltt/branches/poly/include/ltt/tracefile.h
ltt/branches/poly/include/ltt/type.h

index 5570ec46964e83c26b5ed3631768ac9c21134b06..d525cbb552f0b148e903659fcf5b96aedb339241 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef EVENT_H
+#define EVENT_H
+
+#include <ltt/ltt.h>
 
 /* Events and their content, including the raw data, are only valid 
    until reading another event from the same tracefile. 
@@ -71,3 +75,5 @@ double ltt_event_get_double(ltt_event *e, ltt_field *f);
    the same tracefile. */
 
 char *ltt_event_get_string(ltt_event *e, ltt_field *f);
+
+#endif // EVENT_H
index eda320f96efafa2a50daa57f771273a2d6b56a9a..89c997dea2ee20b93c7b041d61bbd01700ef3f0e 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef FACILITY_H
+#define FACILITY_H
 
 #include <ltt/ltt.h>
 
@@ -27,3 +29,4 @@ ltt_eventtype *ltt_facility_eventtype_get(ltt_facility *f, unsigned i);
 
 ltt_eventtype *ltt_facility_eventtype_get_by_name(ltt_facility *f, char *name);
 
+#endif // FACILITY_H
diff --git a/ltt/branches/poly/include/ltt/ltt-private.h b/ltt/branches/poly/include/ltt/ltt-private.h
new file mode 100644 (file)
index 0000000..a15c9f4
--- /dev/null
@@ -0,0 +1,176 @@
+#include <glib.h>
+#include "ltt/ltt.h"
+
+/* structure definition */
+
+typedef struct _trace_header_event {
+  //information of the machine type
+  uint32_t arch_type;          /* Type of architecture */
+  uint32_t arch_variant;        /* Variant of the given type of architecture */
+  uint32_t system_type;                /* Operating system type */
+  char system_name[32];         /* system name */
+  //  uint32_t magic_number;    /* Magic number to identify a trace */ 
+  ltt_arch_size arch_size;      /* data type size */
+  ltt_arch_endian arch_endian;  /* endian type : little or big */
+
+  //format of fields
+  uint8_t  time_size;        /* time size */
+  uint8_t  time_granul;      /* time granularity */
+  uint8_t  id_size;          /* size of combined facility/event ids */
+
+  //other elements
+  uint32_t ip_addr;          /* IP of the machine */
+  uint8_t  cpu_number;       /* number of CPU */
+  uint8_t  cpu_id;           /* cpu id */
+  uint8_t  cpu_number_used;  /* the number of the cpu used in the tracefile */
+  uint32_t buffer_size;             /* Size of blocks */
+} LTT_PACKED_STRUCT trace_header_event;
+
+
+typedef struct _block_header {
+  ltt_time  time;             /* Time stamp of this block */
+  ltt_cycle_count cycle_count; /* cycle count of the event */
+  uint32_t event_count;        /* event count */
+} LTT_PACKED_STRUCT block_header;
+
+
+typedef struct _block_footer {
+  uint32_t unused_bytes;       /* unused bytes at the end of the block */
+  ltt_time time;              /* Time stamp of this block */
+  ltt_cycle_count cycle_count; /* cycle count of the event */
+} LTT_PACKED_STRUCT block_footer;
+
+
+struct _ltt_type{
+  char * element_name;              //elements name of the struct or type name
+  char * fmt;
+  int size;
+  ltt_type_enum type_class;         //which type
+  char ** enum_strings;             //for enum labels
+  struct _ltt_type ** element_type; //for array, sequence and struct
+  unsigned element_number;          //the number of elements 
+                                    //for enum, array, sequence and structure
+};
+
+struct _ltt_eventtype{
+  char * name;
+  char * description;
+  int index;                 //id of the event type within the facility
+  ltt_facility * facility;   //the facility that contains the event type
+  ltt_field * root_field;    //root field
+  int latest_block;          //the latest block using the event type
+  int latest_event;          //the latest event using the event type
+};
+
+struct _ltt_field{
+  unsigned field_pos;        //field position within its parent
+  ltt_type * field_type;     //field type, if it is root field
+                             //then it must be struct type
+
+  off_t offset_root;         //offset from the root, -1:uninitialized 
+  short fixed_root;          //offset fixed according to the root
+                             //-1:uninitialized, 0:unfixed, 1:fixed
+  off_t offset_parent;       //offset from the parent,-1:uninitialized
+  short fixed_parent;        //offset fixed according to its parent
+                             //-1:uninitialized, 0:unfixed, 1:fixed
+  //  void * base_address;       //base address of the field  ????
+  
+  int  field_size;           //>0: size of the field, 
+                             //0 : uncertain
+                             //-1: uninitialize
+  int element_size;          //the element size of the sequence
+  int field_fixed;           //0: field has string or sequence
+                             //1: field has no string or sequenc
+                             //-1: uninitialize
+
+  struct _ltt_field * parent;
+  struct _ltt_field ** child;//for array, sequence and struct: 
+                             //list of fields, it may have only one
+                             //field if the element is not a struct 
+  unsigned current_element;  //which element is currently processed
+};
+
+struct _ltt_event{
+  int event_id;
+  ltt_cycle_count cycle_count;
+  ltt_tracefile * tracefile;
+  void * data;                //event data
+};
+
+struct _ltt_facility{
+  char * name;               //facility name 
+  int event_number;          //number of events in the facility 
+  ltt_checksum checksum;     //checksum of the facility 
+  ltt_eventtype ** events;   //array of event types 
+  unsigned usage_count;      //usage count
+  table all_named_types;     //an array of named ltt_type
+  sequence all_unnamed_types;//an array of unnamed ltt_type
+  sequence all_fields;       //an array of fields
+};
+
+struct _ltt_tracefile{
+  int fd;                            /* file descriptor */
+  off_t file_size;                   /* file size */
+  int block_number;                  /* number of blocks in the file */
+  int which_block;                   /* which block the current block is */
+  int which_event;                   /* which event of the current block 
+                                        is currently processed */
+  ltt_time current_event_time;       /* time of the current event */
+  trace_header_event * trace_header; /* the first event in the first block */
+  block_header * a_block_header;     /* block header of the block*/
+  block_footer * a_block_footer;     /* block footer of the block*/
+  void * first_event_pos;            /* the position of the first event */
+  void * cur_event_pos;              /* the position of the current event */
+  void * buffer;                     /* the buffer containing the block */ 
+  double cycle_per_nsec;             /* Cycles per nsec */ 
+  unsigned int cur_heart_beat_number;/* the number of heart beat so far 
+                                        in the block */
+
+  ltt_time start_time;               /* trace start time */
+  ltt_time end_time;                 /* trace end time */
+  ltt_time prev_block_end_time;      /* the end time of previous block */
+  ltt_time prev_event_time;          /* the time of the previous event */
+
+  int   eventtype_number;            /* the number of event type 
+                                       in the tracefile */
+  int   facility_number;             /* the number of the facility in 
+                                       the tracefile */
+  GHashTable * index_facility;       /* facility index and facility pair */
+  GHashTable * facility_name;        /* name and facility pair */
+  GHashTable * base_id_name;         /* facility name and base id pair*/
+
+  GPtrArray * eventtype_event_id;    /* an array of eventtypes accessed 
+                                       by event id */
+
+  ltt_arch_size my_arch_size;        /* data type size of the local machine */
+  ltt_arch_endian my_arch_endian;    /* endian type of the local machine */
+};
+
+
+
+
+
+/*****************************************************************************
+ macro for size of some data types
+ *****************************************************************************/
+#define EVENT_ID_SIZE     sizeof(int8_t)
+#define CYCLE_COUNT_SIZE   sizeof(ltt_cycle_count)
+//event id and time delta(cycle count)
+//yxx disable during the test
+//#define EVENT_HEADER_SIZE (EVENT_ID_SIZE + CYCLE_COUNT_SIZE)
+#define EVENT_HEADER_SIZE (EVENT_ID_SIZE + sizeof(uint32_t))
+
+
+
+
+/* obtain the time of an event */
+ltt_time getEventTime(ltt_tracefile * tf);
+
+/* get the data type size and endian type of the local machine */
+void getDataEndianType(ltt_arch_size * size, ltt_arch_endian * endian);
+
+
+typedef struct _ptr_wrap{
+  gpointer ptr;
+} ptr_wrap;
+
index a06177e6c2ae67addd843de548a6724f92d98203..2208b925005fe7bee497439f1dc2fdf0bec27024 100644 (file)
@@ -1,5 +1,6 @@
+#ifndef LTT_H
+#define LTT_H
 
-#include <ltt/ltt-private.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
@@ -85,6 +86,17 @@ typedef struct timespec ltt_time;
 
 typedef uint64_t ltt_cycle_count;
 
+typedef enum _ltt_arch_size 
+{ LTT_LP32, LTT_ILP32, LTT_LP64, LTT_ILP64, LTT_UNKNOWN 
+} ltt_arch_size;
+
+typedef enum _ltt_arch_endian
+{ LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN
+} ltt_arch_endian;
 
 
 
+#include <ltt/ltt-private.h>
+
+#endif // LTT_H
index 1477a245284bacbec0e12195a4587bd08a4d6258..79a9dcfa55663e451108b16338e94e5d4e5ac2ea 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef TRACEFILE_H
+#define TRACEFILE_H
 
 #include <ltt/ltt.h>
 
@@ -16,7 +18,7 @@
 
 ltt_tracefile *ltt_tracefile_open(char *pathname);
 
-int ltt_tracefile_close(ltt_tracefile *t, bool close_facilities);
+int ltt_tracefile_close(ltt_tracefile *t, int close_facilities); 
 
 int ltt_tracefile_facility_add(ltt_tracefile *t, ltt_facility *f, int base_id);
 
@@ -28,23 +30,16 @@ int ltt_tracefile_facility_add(ltt_tracefile *t, ltt_facility *f, int base_id);
    host name). All character strings belong to the associated tracefile 
    and are freed when it is closed. */
 
-typedef enum _ltt_arch_size 
-{ LTT_LP32, LTT_ILP32, LTT_LP64, LTT_ILP64 
-} ltt_arch_size;
 
-typedef enum _ltt_arch_endian
-{ LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN
-} ltt_arch_endian;
-char *ltt_tracefile_arch_type(ltt_tracefile *t);  
+uint32_t ltt_tracefile_arch_type(ltt_tracefile *t); 
 
-char *ltt_tracefile_arch_variant(ltt_tracefile *t); 
+uint32_t ltt_tracefile_arch_variant(ltt_tracefile *t);
 
-ltt_arch_size *ltt_tracefile_arch_size(ltt_tracefile *t); 
+ltt_arch_size ltt_tracefile_arch_size(ltt_tracefile *t);
 
-ltt_arch_endian *ltt_tracefile_arch_endian(ltt_tracefile *t); 
+ltt_arch_endian ltt_tracefile_arch_endian(ltt_tracefile *t); 
 
-char *ltt_tracefile_system_type(ltt_tracefile *t);
+uint32_t ltt_tracefile_system_type(ltt_tracefile *t);
 
 char *ltt_tracefile_system_name(ltt_tracefile *t);
 
@@ -56,7 +51,7 @@ unsigned ltt_tracefile_cpu_number(ltt_tracefile *t);
 
 /* Does the tracefile contain events only for a single CPU? */
  
-bool ltt_tracefile_cpu_single(ltt_tracefile *t);
+int ltt_tracefile_cpu_single(ltt_tracefile *t); 
 
 
 /* It this is the case, which CPU? */
@@ -108,3 +103,5 @@ int ltt_tracefile_seek_time(ltt_tracefile *t, ltt_time time);
 /* Read the next event */
 
 ltt_event *ltt_tracefile_read(ltt_tracefile *t);
+
+#endif // TRACEFILE_H
index a65a3200313552a792497b203b506a7f21884f75..822e2c3445185178e9b56bb160a6c67a4180b1df 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef TYPE_H
+#define TYPE_H
 
 #include <ltt/ltt.h>
 
@@ -18,9 +20,9 @@ ltt_type *ltt_eventtype_type(ltt_eventtype *et);
  
 char *ltt_type_name(ltt_type *t);
 
-ltt_type_enum *ltt_type_class(ltt_type *t);
+ltt_type_enum ltt_type_class(ltt_type *t);
 
-unsigned ltt_type_size(ltt_type *t);
+unsigned ltt_type_size(ltt_tracefile * tf, ltt_type *t); 
 
 
 /* The type of nested elements for arrays and sequences. */
@@ -63,3 +65,4 @@ ltt_field *ltt_field_member(ltt_field *f, unsigned i);
 
 ltt_type *ltt_field_type(ltt_field *f);
 
+#endif // TYPE_H
This page took 0.040955 seconds and 4 git commands to generate.