git-svn-id: http://ltt.polymtl.ca/svn@460 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / ltt / ltt-private.h
CommitLineData
fcdf0ec2 1#ifndef LTT_PRIVATE_H
2#define LTT_PRIVATE_H
3
858bd80a 4#include <glib.h>
cbd41522 5#include <sys/types.h>
fcdf0ec2 6#include <ltt/ltt.h>
e3247aa5 7
cbd41522 8#define LTT_PACKED_STRUCT __attribute__ ((packed))
9
e3247aa5 10/* enumeration definition */
11
12typedef enum _BuildinEvent{
13 TRACE_FACILITY_LOAD = 0,
14 TRACE_BLOCK_START = 17,
15 TRACE_BLOCK_END = 18,
0d7aac52 16 TRACE_TIME_HEARTBEAT= 19
e3247aa5 17} BuildinEvent;
fcdf0ec2 18
7c6b3cd7 19
20/* structure definition */
21
e3247aa5 22typedef struct _FacilityLoad{
23 char * name;
24 LttChecksum checksum;
cbd41522 25 guint32 base_code;
e3247aa5 26} LTT_PACKED_STRUCT FacilityLoad;
27
28typedef struct _BlockStart {
29 LttTime time; //Time stamp of this block
30 LttCycleCount cycle_count; //cycle count of the event
cbd41522 31 guint32 block_id; //block id
e3247aa5 32} LTT_PACKED_STRUCT BlockStart;
33
34typedef struct _BlockEnd {
35 LttTime time; //Time stamp of this block
36 LttCycleCount cycle_count; //cycle count of the event
cbd41522 37 guint32 block_id; //block id
e3247aa5 38} LTT_PACKED_STRUCT BlockEnd;
39
40typedef struct _TimeHeartbeat {
41 LttTime time; //Time stamp of this block
42 LttCycleCount cycle_count; //cycle count of the event
43} LTT_PACKED_STRUCT TimeHeartbeat;
44
45
46struct _LttType{
0d7aac52 47 char * type_name; //type name if it is a named type
48 char * element_name; //elements name of the struct
7c6b3cd7 49 char * fmt;
50 int size;
e3247aa5 51 LttTypeEnum type_class; //which type
52 char ** enum_strings; //for enum labels
53 struct _LttType ** element_type; //for array, sequence and struct
54 unsigned element_number; //the number of elements
55 //for enum, array, sequence and structure
7c6b3cd7 56};
57
e3247aa5 58struct _LttEventType{
7c6b3cd7 59 char * name;
60 char * description;
e3247aa5 61 int index; //id of the event type within the facility
62 LttFacility * facility; //the facility that contains the event type
63 LttField * root_field; //root field
64 int latest_block; //the latest block using the event type
65 int latest_event; //the latest event using the event type
7c6b3cd7 66};
67
e3247aa5 68struct _LttField{
7c6b3cd7 69 unsigned field_pos; //field position within its parent
e3247aa5 70 LttType * field_type; //field type, if it is root field
7c6b3cd7 71 //then it must be struct type
72
73 off_t offset_root; //offset from the root, -1:uninitialized
74 short fixed_root; //offset fixed according to the root
75 //-1:uninitialized, 0:unfixed, 1:fixed
76 off_t offset_parent; //offset from the parent,-1:uninitialized
77 short fixed_parent; //offset fixed according to its parent
78 //-1:uninitialized, 0:unfixed, 1:fixed
79 // void * base_address; //base address of the field ????
80
81 int field_size; //>0: size of the field,
82 //0 : uncertain
83 //-1: uninitialize
0d7aac52 84 int sequ_number_size; //the size of unsigned used to save the
85 //number of elements in the sequence
86
7c6b3cd7 87 int element_size; //the element size of the sequence
88 int field_fixed; //0: field has string or sequence
89 //1: field has no string or sequenc
90 //-1: uninitialize
91
e3247aa5 92 struct _LttField * parent;
93 struct _LttField ** child; //for array, sequence and struct:
7c6b3cd7 94 //list of fields, it may have only one
95 //field if the element is not a struct
96 unsigned current_element; //which element is currently processed
97};
98
e3247aa5 99struct _LttEvent{
cbd41522 100 guint16 event_id;
101 guint32 time_delta;
e3247aa5 102 LttTime event_time;
103 LttCycleCount event_cycle_count;
104 LttTracefile * tracefile;
105 void * data; //event data
0d7aac52 106 int which_block; //the current block of the event
107 int which_event; //the position of the event
7c6b3cd7 108};
109
e3247aa5 110struct _LttFacility{
7c6b3cd7 111 char * name; //facility name
112 int event_number; //number of events in the facility
e3247aa5 113 LttChecksum checksum; //checksum of the facility
cbd41522 114 guint32 base_id; //base id of the facility
e3247aa5 115 LttEventType ** events; //array of event types
36921b4e 116 LttType ** named_types;
117 int named_types_number;
7c6b3cd7 118};
119
e3247aa5 120struct _LttTracefile{
121 char * name; //tracefile name
122 LttTrace * trace; //trace containing the tracefile
123 int fd; //file descriptor
124 off_t file_size; //file size
125 unsigned block_size; //block_size
126 int block_number; //number of blocks in the file
127 int which_block; //which block the current block is
128 int which_event; //which event of the current block
129 //is currently processed
130 LttTime current_event_time; //time of the current event
131 BlockStart * a_block_start; //block start of the block
132 BlockEnd * a_block_end; //block end of the block
133 void * cur_event_pos; //the position of the current event
134 void * buffer; //the buffer containing the block
135 double cycle_per_nsec; //Cycles per nsec
136 unsigned cur_heart_beat_number; //current number of heart beat in the buf
fb1a869e 137 LttCycleCount cur_cycle_count; //current cycle count of the event
e37c1372 138 void * last_event_pos;
e3247aa5 139
140 LttTime prev_block_end_time; //the end time of previous block
141 LttTime prev_event_time; //the time of the previous event
7525f9e5 142 LttEvent an_event;
dd691a2e 143 LttCycleCount pre_cycle_count; //previous cycle count of the event
144 int count; //the number of overflow of cycle count
7c6b3cd7 145};
146
e3247aa5 147struct _LttTrace{
148 char * pathname; //the pathname of the trace
149 guint facility_number; //the number of facilities
150 guint control_tracefile_number; //the number of control files
151 guint per_cpu_tracefile_number; //the number of per cpu files
152 LttSystemDescription * system_description;//system description
80da81ad 153
e3247aa5 154 GPtrArray *control_tracefiles; //array of control tracefiles
155 GPtrArray *per_cpu_tracefiles; //array of per cpu tracefiles
156 GPtrArray *facilities; //array of facilities
157 LttArchSize my_arch_size; //data size of the local machine
158 LttArchEndian my_arch_endian; //endian type of the local machine
159};
7c6b3cd7 160
80da81ad 161struct _LttEventPosition{
162 unsigned block_num; //block which contains the event
163 unsigned event_num; //event index in the block
164 unsigned event_offset; //event position in the block
165 LttTime event_time; //the time of the event
166 LttCycleCount event_cycle_count; //the cycle count of the event
167 unsigned heart_beat_number; //current number of heart beats
fb1a869e 168 LttTracefile *tf; //tracefile containing the event
80da81ad 169 gboolean old_position; //flag to show if it is the position
170 //being remembered
171};
7c6b3cd7 172
a5dcde2f 173/* The characteristics of the system on which the trace was obtained
174 is described in a LttSystemDescription structure. */
175
176struct _LttSystemDescription {
177 char *description;
178 char *node_name;
179 char *domain_name;
180 unsigned nb_cpu;
181 LttArchSize size;
182 LttArchEndian endian;
183 char *kernel_name;
184 char *kernel_release;
185 char *kernel_version;
186 char *machine;
187 char *processor;
188 char *hardware_platform;
189 char *operating_system;
190 unsigned ltt_major_version;
191 unsigned ltt_minor_version;
192 unsigned ltt_block_size;
193 LttTime trace_start;
194 LttTime trace_end;
195};
196
7c6b3cd7 197/*****************************************************************************
198 macro for size of some data types
199 *****************************************************************************/
cbd41522 200#define EVENT_ID_SIZE sizeof(guint16)
201#define TIME_DELTA_SIZE sizeof(guint32)
e3247aa5 202#define EVENT_HEADER_SIZE (EVENT_ID_SIZE + TIME_DELTA_SIZE)
7c6b3cd7 203
204
fcdf0ec2 205#endif /* LTT_PRIVATE_H */
This page took 0.035404 seconds and 4 git commands to generate.