memory.xml \
network.xml \
process.xml \
-s390_kernel.xml \
socket.xml \
timer.xml
memory.xml \
network.xml \
process.xml \
-s390_kernel.xml \
socket.xml \
timer.xml
<field name="name"><string/></field>
<field name="checksum"><uint size=4/></field>
<field name="id"><uint size=4/></field>
- <field name="int_size"><size_t/></field>
- <field name="long_size"><size_t/></field>
- <field name="pointer_size"><size_t/></field>
- <field name="size_t_size"><size_t/></field>
- <field name="alignment"><size_t/></field>
+ <field name="int_size"><uint size=4/></field>
+ <field name="long_size"><uint size=4/></field>
+ <field name="pointer_size"><uint size=4/></field>
+ <field name="size_t_size"><uint size=4/></field>
+ <field name="has_alignment"><uint size=4/></field>
</event>
<event name=facility_unload>
<field name="long_size"><uint size=4/></field>
<field name="pointer_size"><uint size=4/></field>
<field name="size_t_size"><uint size=4/></field>
- <field name="alignment"><uint size=4/></field>
+ <field name="has_alignment"><uint size=4/></field>
</event>
</facility>
#include <ltt/trace.h>
#include <ltt/ltt-types.h>
+
+
+void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset,
+ void *root);
+
+
+
+
LttEvent *ltt_event_new()
{
return g_new(LttEvent, 1);
return &g_array_index(facility->events, LttEventType, e->event_id);
}
-/*****************************************************************************
- *Function name
- * ltt_event_field : get the root field of the event
- *Input params
- * e : an instance of an event type
- * name : field name
- *Return value
- * LttField * : The requested field, or NULL
- ****************************************************************************/
-
-LttField *ltt_event_field(LttEvent *e, GQuark name)
-{
- LttField * field;
- LttEventType * event_type = ltt_event_eventtype(e);
- if(unlikely(!event_type)) return NULL;
-
- return (LttField*)g_datalist_id_get_data(&event_type->fields_by_name, name);
-
-}
/*****************************************************************************
*Function name
****************************************************************************/
guint64 ltt_event_field_element_number(LttEvent *e, LttField *f)
{
- if(f->field_type->type_class != LTT_ARRAY &&
- f->field_type->type_class != LTT_SEQUENCE)
+ if(f->field_type.type_class != LTT_ARRAY &&
+ f->field_type.type_class != LTT_SEQUENCE)
return 0;
- if(f->field_type->type_class == LTT_ARRAY)
- return f->field_type->size;
- return ltt_get_long_unsigned(e, &g_array_index(f->fields, LttField, 0));
+ if(f->field_type.type_class == LTT_ARRAY)
+ return f->field_type.size;
+ return ltt_event_get_long_unsigned(e, &g_array_index(f->field_type.fields,
+ LttField, 0));
}
/*****************************************************************************
LttEventType *event_type;
off_t new_offset;
- if(f->field_type->type_class != LTT_ARRAY &&
- f->field_type->type_class != LTT_SEQUENCE)
+ if(f->field_type.type_class != LTT_ARRAY &&
+ f->field_type.type_class != LTT_SEQUENCE)
return ;
element_number = ltt_event_field_element_number(e,f);
*/
if(i >= element_number) return;
- if(f->field_type->type_class == LTT_ARRAY) {
- field = &g_array_index(f->fields, LttField, 0);
+ if(f->field_type.type_class == LTT_ARRAY) {
+ field = &g_array_index(f->field_type.fields, LttField, 0);
} else {
- field = &g_array_index(f->fields, LttField, 1);
+ field = &g_array_index(f->field_type.fields, LttField, 1);
}
if(field->field_size != 0) {
/* Var. len. child */
new_offset = g_array_index(f->dynamic_offsets, off_t, i);
}
- compute_fields_offsets(e->tracefile, field, new_offset);
+ compute_fields_offsets(e->tracefile, field, &new_offset, e->data);
return field;
}
{
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
- LttTypeEnum t = f->field_type->type_class;
-
- g_assert(t == LTT_UINT || t == LTT_ENUM);
+ LttTypeEnum t = f->field_type.type_class;
if(f->field_size == 1){
guint8 x = *(guint8 *)(e->data + f->offset_root);
{
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
- g_assert(f->field_type->type_class == LTT_INT);
-
if(f->field_size == 1){
gint8 x = *(gint8 *)(e->data + f->offset_root);
return (gint32) x;
{
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
- LttTypeEnum t = f->field_type->type_class;
-
- g_assert(t == LTT_UINT || t == LTT_ENUM
- || t == LTT_ULONG || LTT_SIZE_T || LTT_OFF_T || LTT_POINTER);
+ LttTypeEnum t = f->field_type.type_class;
if(f->field_size == 1){
guint8 x = *(guint8 *)(e->data + f->offset_root);
// e->tracefile->trace->system_description->endian ? 0:1;
gboolean reverse_byte_order = LTT_GET_BO(e->tracefile);
- g_assert( f->field_type->type_class == LTT_INT
- || f->field_type->type_class == LTT_LONG
- || f->field_type->type_class == LTT_SSIZE_T);
-
if(f->field_size == 1){
gint8 x = *(gint8 *)(e->data + f->offset_root);
return (gint64) x;
g_assert(LTT_HAS_FLOAT(e->tracefile));
gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
- g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 4);
+ g_assert(f->field_type.type_class == LTT_FLOAT && f->field_size == 4);
if(reverse_byte_order == 0) return *(float *)(e->data + f->offset_root);
else{
g_assert(LTT_HAS_FLOAT(e->tracefile));
gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile);
- g_assert(f->field_type->type_class == LTT_FLOAT && f->field_size == 8);
+ if(f->field_size == 4)
+ return ltt_event_get_float(e, f);
+
+ g_assert(f->field_type.type_class == LTT_FLOAT && f->field_size == 8);
if(reverse_byte_order == 0) return *(double *)(e->data + f->offset_root);
else {
****************************************************************************/
char *ltt_event_get_string(LttEvent *e, LttField *f)
{
- g_assert(f->field_type->type_class == LTT_STRING);
+ g_assert(f->field_type.type_class == LTT_STRING);
return (gchar*)g_strdup((gchar*)(e->data + f->offset_root));
}
void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset,
void *root)
{
- type = &field->field_type;
+ LttType *type = &field->field_type;
switch(type->type_class) {
case LTT_INT_FIXED:
0);
for(i=0; i<type->size; i++) {
g_array_append_val(field->dynamic_offsets, *offset);
- compute_fields_offsets(tf, child, offset);
+ compute_fields_offsets(tf, child, offset, root);
}
}
// local_offset = field->array_offset;
// /* Set the offset at position 0 */
- // compute_fields_offsets(tf, child, &local_offset);
- break;
+ // compute_fields_offsets(tf, child, &local_offset, root);
+ }
+ break;
case LTT_SEQUENCE:
g_assert(type->fields->len == 2);
{
field->offset_root = *offset;
child = &g_array_index(type->fields, LttField, 0);
- compute_fields_offsets(tf, child, offset);
+ compute_fields_offsets(tf, child, offset, root);
child = &g_array_index(type->fields, LttField, 1);
*offset += ltt_align(*offset, get_alignment(tf, child),
tf->has_alignment);
0);
for(i=0; i<ltt_event_field_element_number(&tf->event, field); i++) {
g_array_append_val(field->dynamic_offsets, *offset);
- compute_fields_offsets(tf, child, offset);
+ compute_fields_offsets(tf, child, offset, root);
}
// local_offset = field->array_offset;
// /* Set the offset at position 0 */
- // compute_fields_offsets(tf, child, &local_offset);
+ // compute_fields_offsets(tf, child, &local_offset, root);
}
break;
case LTT_STRUCT:
}
for(i=0; i<type->fields->len; i++) {
child = &g_array_index(type->fields, LttField, i);
- compute_fields_offsets(tf, child, offset);
+ compute_fields_offsets(tf, child, offset, root);
}
}
break;
for(i=0; i<type->fields->len; i++) {
*offset = field->offset_root;
child = &g_array_index(type->fields, LttField, i);
- compute_fields_offsets(tf, child, offset);
+ compute_fields_offsets(tf, child, offset, root);
}
*offset = field->offset_root + field->field_size;
}
* event : event type
*
****************************************************************************/
-void compute_offsets(LttTracefile *tf, LttEventType *event, size_t *offset,
+void compute_offsets(LttTracefile *tf, LttEventType *event, off_t *offset,
void *root)
{
guint i;
/* compute all variable offsets */
for(i=0; i<event->fields->len; i++) {
LttField *field = &g_array_index(event->fields, LttField, i);
- ret = compute_fields_offsets(tf, field, offset, root);
+ compute_fields_offsets(tf, field, offset, root);
if(ret) break;
}
LttEventType *ltt_event_eventtype(const LttEvent *e);
-/* Root field for the event */
-
-LttField *ltt_event_field(LttEvent *e);
-
/* Time and cycle count for the event */
/* Set the currently selected element for a sequence or array field. */
-void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i);
+LttField *ltt_event_field_element_select(LttEvent *e, LttField *f, gulong i);
/* A union is like a structure except that only a single member at a time
gchar *ltt_event_get_string(LttEvent *e, LttField *f);
-size_t get_field_type_size(LttTracefile *tf,
- LttEventType *event_type,
- off_t offset_root, off_t offset_parent,
- LttField *field, void *data);
-
-
+void compute_offsets(LttTracefile *tf, LttEventType *event, off_t *offset,
+ void *root);
#endif // EVENT_H
LttType * lookup_named_type(LttFacility *fac, type_descriptor_t * td);
/* construct directed acyclic graph for types, and tree for fields */
-void construct_types_and_fields(LttFacility * fac, type_descriptor_t * td,
- LttField * fld);
+void construct_fields(LttFacility *fac,
+ LttField *field,
+ field_t *fld);
/* generate the facility according to the events belongin to it */
void generateFacility(LttFacility * f, facility_t * fac,
/* functions to release the memory occupied by a facility */
void freeFacility(LttFacility * facility);
void freeEventtype(LttEventType * evType);
-void freeLttType(LttType ** type);
+void freeLttType(LttType * type);
void freeLttField(LttField * fld);
void freeLttNamedType(LttType * type);
gchar *token;
parse_file_t in;
facility_t * fac;
- unsigned long checksum;
+ unsigned int checksum;
gchar buffer[BUFFER_SIZE];
gboolean generated = FALSE;
f->events = g_array_set_size(f->events, events->position);
g_datalist_init(&f->events_by_name);
- g_datalist_init(&f->named_types);
+ // g_datalist_init(&f->named_types);
#if 0
/* The first day, he created the named types */
/* The second day, he created the event fields and types */
//for each event, construct field and type acyclic graph
for(i=0;i<events->position;i++){
- event_t parser_event = (event_t*)events->array[i];
+ event_t *parser_event = (event_t*)events->array[i];
LttEventType *event_type = &g_array_index(f->events, LttEventType, i);
event_type->name =
LttField *field = &g_array_index(event_type->fields, LttField, j);
field_t *parser_field = (field_t*)parser_event->fields.array[j];
- construct_types_and_fields(NULL, NULL, field, parser_field, ...);
+ construct_fields(f, field, parser_field);
g_datalist_id_set_data(&event_type->fields_by_name,
field->name,
field);
{
guint len;
type_descriptor_t *td;
+ LttType *type;
field->name = g_quark_from_string(fld->name);
if(fld->description) {
type->size = fac->int_size;
{
guint i;
- g_datalist_init(&type->enum_map);
+ type->enum_map = g_hash_table_new(g_int_hash, g_int_equal);
for(i=0; i<td->labels.position; i++) {
- GQuark key = g_quark_from_string((char*)td->labels.array[i]);
- int *src = (int*)td->labels_values.array[i];
- /* it's always ok to cast a int to a pointer type */
- g_datalist_id_set_data(&type->enum_map, key, (gpointer)*src);
+ GQuark value = g_quark_from_string((char*)td->labels.array[i]);
+ gint key = *(int*)td->labels_values.array[i];
+ g_hash_table_insert(type->enum_map, (gpointer)key, (gpointer)value);
}
}
break;
g_free(evType->description);
for(i=0; i<evType->fields->len;i++) {
- freeLttType(&g_array_index(evType->fields, LttType, i));
+ LttField *field = &g_array_index(evType->fields, LttField, i);
+ freeLttField(field);
}
g_array_free(evType->fields, TRUE);
g_datalist_clear(&evType->fields_by_name);
g_free(type->fmt);
if(type->enum_map)
- g_datalist_clear(&type->enum_map);
+ g_hash_table_destroy(type->enum_map);
if(type->fields) {
for(i=0; i<type->fields->len; i++) {
freeLttType(type);
}
-void copy_enum_element(GQuark keyid, gpointer data, gpointer user_data)
-{
- int *value = gpointer data;
-
-}
-
void freeLttField(LttField * field)
{
if(field->description)
g_free(field->description);
if(field->dynamic_offsets)
g_array_free(field->dynamic_offsets, TRUE);
- freeLttType(field->type);
+ freeLttType(&field->field_type);
}
/*****************************************************************************
#define max(a,b) ((a)>(b)?(a):(b))
#endif
+#ifndef min
+#define min(a,b) ((a)<(b)?(a):(b))
+#endif
+
+
#define LTT_MAGIC_NUMBER 0x00D6B7ED
#define LTT_REV_MAGIC_NUMBER 0xEDB7D600
gchar * fmt;
guint size;
LttTypeEnum type_class; //which type
- GData *enum_map; //maps enum labels to numbers.
+ GHashTable *enum_map; //maps enum labels to numbers.
GArray *fields; // Array of LttFields, for array, sequence, union, struct.
GData *fields_by_name;
};
unsigned long crc ;
int pos;
event_t * ev;
+ unsigned int i;
crc = crc32(facName);
for(pos = 0; pos < events->position; pos++){
ev = (event_t *)(events->array[pos]);
crc = partial_crc32(ev->name, crc);
- for(unsigned int i = 0; i < ev->fields.position; i++) {
+ for(i = 0; i < ev->fields.position; i++) {
field_t *f = (field_t*)ev->fields.array[i];
crc = partial_crc32(f->name, crc);
crc = getTypeChecksum(crc, f->type);
void ltt_update_event_size(LttTracefile *tf);
+
+void precompute_offsets(LttTracefile *tf, LttEventType *event);
+
#if 0
/* Functions to parse system.xml file (using glib xml parser) */
static void parser_start_element (GMarkupParseContext __UNUSED__ *context,
fac->size_t_size = ltt_get_uint32(LTT_GET_BO(tf),
&fac_load_data->size_t_size);
fac->alignment = ltt_get_uint32(LTT_GET_BO(tf),
- &fac_load_data->alignment);
+ &fac_load_data->has_alignment);
if(ltt_get_facility_description(fac, tf->trace, tf))
continue; /* error opening description */
fac->size_t_size = ltt_get_uint32(LTT_GET_BO(tf),
&fac_state_dump_load_data->size_t_size);
fac->alignment = ltt_get_uint32(LTT_GET_BO(tf),
- &fac_state_dump_load_data->alignment);
+ &fac_state_dump_load_data->has_alignment);
if(ltt_get_facility_description(fac, tf->trace, tf))
continue; /* error opening description */
/* Read event header */
/* Align the head */
- pos += ltt_align(pos, tf->trace->arch_size, tf->has_alignment);
+ pos += ltt_align((size_t)pos, tf->trace->arch_size, tf->has_alignment);
if(tf->trace->has_tsc) {
if(tf->trace->has_heartbeat) {
pos += sizeof(guint16);
/* Align the head */
- pos += ltt_align(pos, tf->trace->arch_size, tf->has_alignment);
+ pos += ltt_align((size_t)pos, tf->trace->arch_size, tf->has_alignment);
event->data = pos;
/* It will update the fields offsets too */
void ltt_update_event_size(LttTracefile *tf)
{
- size_t size = 0;
+ off_t size = 0;
/* Specific handling of core events : necessary to read the facility control
* tracefile. */
****************************************************************************/
off_t get_alignment(LttTracefile *tf, LttField *field)
{
- type = &field->field_type;
+ LttType *type = &field->field_type;
switch(type->type_class) {
case LTT_INT_FIXED:
void field_compute_static_size(LttTracefile *tf, LttField *field)
{
- type = &field->field_type;
+ LttType *type = &field->field_type;
switch(type->type_class) {
case LTT_INT_FIXED:
case LTT_SEQUENCE:
g_assert(type->fields->len == 2);
{
- local_offset = 0;
+ off_t local_offset = 0;
LttField *child = &g_array_index(type->fields, LttField, 1);
field_compute_static_size(tf, child);
field->field_size = 0;
break;
default:
g_error("field_static_size : unknown type");
+ }
}
gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset)
{
- type = &field->field_type;
+ LttType *type = &field->field_type;
switch(type->type_class) {
case LTT_INT_FIXED:
LttField *field1, LttField *field2)
{
guint different = 0;
+ LttType *type1;
+ LttType *type2;
if(field1 == NULL) {
if(field2 == NULL) goto end;
goto end;
}
- type1 = field1->field_type;
- type2 = field2->field_type;
+ type1 = &field1->field_type;
+ type2 = &field2->field_type;
if(type1->type_class != type2->type_class) {
different = 1;
goto end;
}
- if(type1->element_name != type2->element_name) {
- different = 1;
- goto end;
- }
switch(type1->type_class) {
case LTT_INT_FIXED:
}
for(i=0; i< type1->fields->len; i++) {
+ LttField *child1;
+ LttField *child2;
child1 = &g_array_index(type1->fields, LttField, i);
child2 = &g_array_index(type2->fields, LttField, i);
different = check_fields_compatibility(event_type1,
/*****************************************************************************
*Function name
- * ltt_eventtype_type : get the type of the event type
+ * ltt_field_name : get the name of the field
*Input params
- * et : an event type
- *Return value
- * LttType * : the type of the event type
- ****************************************************************************/
-
-LttType *ltt_eventtype_type(LttEventType *et)
-{
- if(unlikely(!et->root_field)) return NULL;
- else return et->root_field->field_type;
-}
-
-/*****************************************************************************
- *Function name
- * ltt_eventtype_field : get the root filed of the event type
- *Input params
- * et : an event type
- *Return value
- * LttField * : the root filed of the event type
- ****************************************************************************/
-
-LttField *ltt_eventtype_field(LttEventType *et)
-{
- return et->root_field;
-}
-
-/*****************************************************************************
- *Function name
- * ltt_type_name : get the name of the type
- *Input params
- * t : a type
+ * f : a field
*Return value
* char * : the name of the type
****************************************************************************/
-GQuark ltt_type_name(LttType *t)
+GQuark ltt_field_name(LttField *f)
{
- return t->element_name;
+ return f->name;
}
-
/*****************************************************************************
*Function name
* ltt_type_class : get the type class of the type
LttType *ltt_type_element_type(LttType *t)
{
LttType *element_type;
+ LttField *field;
if(unlikely(t->type_class != LTT_ARRAY && t->type_class != LTT_SEQUENCE))
element_type = NULL;
- else
- element_type = t->element_type[0];
+ else {
+ if(t->type_class == LTT_ARRAY)
+ field = &g_array_index(t->fields, LttField, 0);
+ else
+ field = &g_array_index(t->fields, LttField, 1);
+ element_type = ltt_field_type(field);
+ }
return element_type;
}
*Return value
* unsigned : the number of elements for arrays
****************************************************************************/
-
+#if 0
unsigned ltt_type_element_number(LttType *t)
{
unsigned ret = 0;
return ret;
}
-
+#endif //0
/*****************************************************************************
*Function name
* ltt_type_member_number : obtain the number of data members for structure
unsigned ret = 0;
if(likely(t->type_class == LTT_STRUCT || t->type_class == LTT_UNION))
- ret =t->element_number;
+ ret = t->fields->len;
return ret;
}
-/*****************************************************************************
- *Function name
- * ltt_type_member_type : obtain the type of a data member in a structure
- * or union.
- *Input params
- * t : a type
- * i : index of the member
- *Return value
- * LttType * : the type of structure member
- ****************************************************************************/
-
-LttType *ltt_type_member_type(LttType *t, unsigned i, GQuark *name)
-{
- LttType *member_type = NULL;
-
- if(unlikely( (t->type_class != LTT_STRUCT
- && t->type_class != LTT_UNION)
- ||
- (i >= t->element_number)
- )) {
- *name = 0;
- } else {
- *name = t->element_type[i]->element_name;
- member_type = t->element_type[i];
- }
-
- return member_type;
-}
/*****************************************************************************
*Function name
* char * : symbolic string associated with a value
****************************************************************************/
-GQuark ltt_enum_string_get(LttType *t, unsigned i)
+GQuark ltt_enum_string_get(LttType *t, gulong i)
{
- if(likely(t->type_class == LTT_ENUM && i < t->element_number))
- return t->enum_strings[i];
+ if(likely(t->type_class == LTT_ENUM))
+ return (GQuark)g_hash_table_lookup(t->enum_map, (gpointer)i);
else
return 0;
}
-
+#if 0
/*****************************************************************************
*Function name
* ltt_field_element : obtain the field of nested elements for arrays and
return nest;
}
+#endif//0
+
+/*****************************************************************************
+ *Function name
+ * ltt_field_member_by_name : obtain the field of data members for structure
+ *Input params
+ * f : a field
+ * name : name of the field
+ *Return value
+ * LttField * : the field of the nested element
+ ****************************************************************************/
+
+LttField *ltt_field_member_by_name(LttField *f, GQuark name)
+{
+ LttField *field_member;
+
+ g_assert(f->field_type.type_class == LTT_STRUCT ||
+ f->field_type.type_class == LTT_UNION);
+
+ field_member = g_datalist_id_get_data(&f->field_type.fields_by_name, name);
+
+ return field_member;
+}
+
/*****************************************************************************
*Function name
* LttField * : the field of the nested element
****************************************************************************/
-LttField *ltt_field_member(LttField *f, unsigned i)
+LttField *ltt_field_member(LttField *f, guint i)
{
LttField *field_member;
- g_assert(f->field_type->type_class == LTT_STRUCT ||
- f->field_type->type_class == LTT_UNION);
- g_assert(i < f->field_type->element_number);
-#if 0
- if(unlikely( f->field_type->type_class != LTT_STRUCT
- && f->field_type->type_class != LTT_UNION)
- || i >= f->field_type->element_number )
- field_member = NULL;
- else
-#endif //0
- field_member = f->child[i];
+ g_assert(f->field_type.type_class == LTT_STRUCT ||
+ f->field_type.type_class == LTT_UNION);
+ g_assert(i < f->field_type.fields->len);
+
+ field_member = &g_array_index(f->field_type.fields, LttField, i);
return field_member;
}
LttType *ltt_field_type(LttField *f)
{
if(unlikely(!f))return NULL;
- return f->field_type;
+ return &f->field_type;
}
int ltt_field_size(LttField * f)
if(unlikely(!f))return 0;
return f->field_size;
}
+
+
+/*****************************************************************************
+ *Function name
+ * ltt_eventtype_num_fields : get the number of fields of the event
+ *Input params
+ * e : an instance of an event type
+ *Return value
+ * guint : number of fields
+ ****************************************************************************/
+
+guint ltt_eventtype_num_fields(LttEventType *event_type)
+{
+ if(unlikely(!event_type)) return NULL;
+
+ return event_type->fields->len;
+
+}
+/*****************************************************************************
+ *Function name
+ * ltt_eventtype_field : get the i th field of the event
+ *Input params
+ * e : an instance of an event type
+ * i : field index
+ *Return value
+ * LttField * : The requested field, or NULL
+ ****************************************************************************/
+
+LttField *ltt_eventtype_field(LttEventType *event_type, guint i)
+{
+ if(unlikely(!event_type)) return NULL;
+
+ if(i >= event_type->fields->len) return NULL;
+
+ return &g_array_index(event_type->fields, LttField, i);
+
+}
+
+/*****************************************************************************
+ *Function name
+ * ltt_eventtype_field_by_name : get a field of the event
+ *Input params
+ * e : an instance of an event type
+ * name : field name
+ *Return value
+ * LttField * : The requested field, or NULL
+ ****************************************************************************/
+
+LttField *ltt_eventtype_field_by_name(LttEventType *event_type, GQuark name)
+{
+ if(unlikely(!event_type)) return NULL;
+
+ return (LttField*)g_datalist_id_get_data(&event_type->fields_by_name, name);
+
+}
+
+
guint8 ltt_eventtype_id(LttEventType *et);
-LttType *ltt_eventtype_type(LttEventType *et);
-
-LttField *ltt_eventtype_field(LttEventType *et);
-
-
/* obtain the type name and size. The size is the number of bytes for
primitive types (INT, UINT, FLOAT, ENUM), or the size for the unsigned
integer length count for sequences. */
GQuark ltt_type_name(LttType *t);
+GQuark ltt_field_name(LttField *f);
+
LttTypeEnum ltt_type_class(LttType *t);
unsigned ltt_type_size(LttTrace *trace, LttType *t);
/* The number of elements for arrays. */
-unsigned ltt_type_element_number(LttType *t);
+//unsigned ltt_type_element_number(LttType *t);
/* The number of data members for structures and unions. */
-unsigned ltt_type_member_number(LttType *t);
-
-
-/* The type of a data member in a structure. */
-
-LttType *ltt_type_member_type(LttType *t, unsigned i, GQuark *name);
+guint ltt_type_member_number(LttType *t);
/* For enumerations, obtain the symbolic string associated with a value
(0 to n - 1 for an enumeration of n elements). */
-GQuark ltt_enum_string_get(LttType *t, unsigned i);
+GQuark ltt_enum_string_get(LttType *t, gulong i);
/* The fields form a tree representing a depth first search of the
platform/trace specific offset values (for efficient access) and
points back to the corresponding LttType for the rest. */
-LttField *ltt_field_element(LttField *f);
+//LttField *ltt_field_element(LttField *f);
+
+LttField *ltt_field_member_by_name(LttField *f, GQuark name);
-LttField *ltt_field_member(LttField *f, unsigned i);
+LttField *ltt_field_member(LttField *f, guint i);
LttType *ltt_field_type(LttField *f);
int ltt_field_size(LttField * f);
+guint ltt_eventtype_num_fields(LttEventType *event_type);
+
+LttField *ltt_eventtype_field(LttEventType *event_type, guint i);
+
+LttField *ltt_eventtype_field_by_name(LttEventType *event_type, GQuark name);
+
#endif // TYPE_H
#include <sys/stat.h>
/* Buffer for file copy : 4k seems optimal. */
-#define BUF_SIZE 4194304
+#define BUF_SIZE 4096
enum trace_ctl_op {
CTL_OP_CREATE_START,
}
err = TEMP_FAILURE_RETRY(write(pair->trace,
- pair->mmap + (consumed_old & (~(pair->subbuf_size-1))),
+ pair->mmap
+ + (consumed_old & ((pair->n_subbufs * pair->subbuf_size)-1)),
pair->subbuf_size));
if(err < 0) {
LttType *type;
- LttField *element;
-
GQuark name;
int nb, i;
case LTT_SEQUENCE:
g_string_append_printf(s, "{ ");
nb = ltt_event_field_element_number(e,f);
- element = ltt_field_element(f);
for(i = 0 ; i < nb ; i++) {
- ltt_event_field_element_select(e,f,i);
- lttv_print_field(e, element, s, field_names);
+ LttField *child = ltt_event_field_element_select(e,f,i);
+ lttv_print_field(e, child, s, field_names);
if(i != nb-1) g_string_append_printf(s, ", ");
}
g_string_append_printf(s, " }");
g_string_append_printf(s, "{ ");
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
+ LttField *element;
element = ltt_field_member(f,i);
if(field_names) {
- ltt_type_member_type(type, i, &name);
+ name = ltt_field_name(element);
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
lttv_print_field(e, element, s, field_names);
g_string_append_printf(s, "{ ");
nb = ltt_type_member_number(type);
for(i = 0 ; i < nb ; i++) {
+ LttField *element;
element = ltt_field_member(f,i);
if(field_names) {
- ltt_type_member_type(type, i, &name);
+ name = ltt_field_name(element);
g_string_append_printf(s, "%s = ", g_quark_to_string(name));
}
lttv_print_field(e, element, s, field_names);
}
g_string_append_printf(s, " }");
break;
-
+ case LTT_NONE:
+ break;
}
}
LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context;
LttvProcessState *process = ts->running_process[cpu];
+ GQuark name;
+
guint i, num_fields;
g_string_set_size(s,0);
num_fields = ltt_eventtype_num_fields(event_type);
for(i=0; i<num_fields; i++) {
- field = ltt_event_field(event_type, i);
+ field = ltt_eventtype_field(event_type, i);
+ if(field_names) {
+ name = ltt_field_name(field);
+ if(name)
+ g_string_append_printf(s, "%s = ", g_quark_to_string(name));
+ }
lttv_print_field(e, field, s, field_names);
}
}
thf = lttv_trace_hook_get_first(&h);
t = ltt_field_type(thf->f1);
- nb = ltt_type_element_number(t);
+ //nb = ltt_type_element_number(t);
lttv_trace_hook_destroy(&h);
thf = lttv_trace_hook_get_first(&h);
t = ltt_field_type(thf->f1);
- nb = ltt_type_element_number(t);
+ //nb = ltt_type_element_number(t);
lttv_trace_hook_destroy(&h);
thf = lttv_trace_hook_get_first(&h);
t = ltt_field_type(thf->f1);
- nb = ltt_type_element_number(t);
+ //nb = ltt_type_element_number(t);
lttv_trace_hook_destroy(&h);
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/gnu/stubs.h /usr/include/bits/huge_val.h \
/usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \
- /usr/include/bits/mathinline.h /usr/include/glib-2.0/glib.h \
- /usr/include/glib-2.0/glib/galloca.h \
+ /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \
/usr/include/glib-2.0/glib/gtypes.h \
/usr/lib/glib-2.0/include/glibconfig.h \
/usr/include/glib-2.0/glib/gmacros.h \
- /usr/lib/gcc-lib/i486-linux/3.3.5/include/stddef.h \
- /usr/lib/gcc-lib/i486-linux/3.3.5/include/limits.h \
- /usr/lib/gcc-lib/i486-linux/3.3.5/include/syslimits.h \
+ /usr/lib/gcc/i486-linux-gnu/4.0.2/include/stddef.h \
+ /usr/lib/gcc/i486-linux-gnu/4.0.2/include/limits.h \
+ /usr/lib/gcc/i486-linux-gnu/4.0.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h \
- /usr/lib/gcc-lib/i486-linux/3.3.5/include/float.h \
+ /usr/lib/gcc/i486-linux-gnu/4.0.2/include/float.h \
/usr/include/glib-2.0/glib/garray.h \
/usr/include/glib-2.0/glib/gasyncqueue.h \
/usr/include/glib-2.0/glib/gthread.h \
/usr/include/glib-2.0/glib/gstring.h \
/usr/include/glib-2.0/glib/gunicode.h \
/usr/include/glib-2.0/glib/gutils.h \
- /usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h \
+ /usr/lib/gcc/i486-linux-gnu/4.0.2/include/stdarg.h \
/usr/include/glib-2.0/glib/gkeyfile.h \
+ /usr/include/glib-2.0/glib/gmappedfile.h \
/usr/include/glib-2.0/glib/gmarkup.h \
/usr/include/glib-2.0/glib/gmessages.h \
/usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h \
/usr/include/bits/typesizes.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
/usr/include/gconv.h /usr/include/bits/stdio_lim.h \
- /usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \
- /usr/include/glib-2.0/gmodule.h \
+ /usr/include/bits/sys_errlist.h /usr/include/glib-2.0/gmodule.h \
/usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h \
/usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h \
/usr/include/gtk-2.0/gdk/gdkdisplay.h \
/usr/include/atk-1.0/atk/atknoopobjectfactory.h \
/usr/include/atk-1.0/atk/atkobjectfactory.h \
/usr/include/atk-1.0/atk/atkregistry.h \
+ /usr/include/atk-1.0/atk/atkobjectfactory.h \
/usr/include/atk-1.0/atk/atkrelation.h \
/usr/include/atk-1.0/atk/atkrelationset.h \
/usr/include/atk-1.0/atk/atkselection.h \
/usr/include/gtk-2.0/gtk/gtkfilechooser.h \
/usr/include/gtk-2.0/gtk/gtkfilefilter.h \
/usr/include/gtk-2.0/gtk/gtkfilechooserdialog.h \
+ /usr/include/gtk-2.0/gtk/gtkfilechooser.h \
/usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h \
/usr/include/gtk-2.0/gtk/gtkfontbutton.h \
/usr/include/gtk-2.0/gtk/gtkfontsel.h \
/usr/include/gtk-2.0/gtk/gtkmain.h \
/usr/include/gtk-2.0/gtk/gtkmenubar.h \
/usr/include/gtk-2.0/gtk/gtkmenutoolbutton.h \
+ /usr/include/gtk-2.0/gtk/gtkmenu.h \
/usr/include/gtk-2.0/gtk/gtktoolbutton.h \
/usr/include/gtk-2.0/gtk/gtktoolitem.h \
/usr/include/gtk-2.0/gtk/gtktooltips.h \
/usr/include/gtk-2.0/gtk/gtkradiomenuitem.h \
/usr/include/gtk-2.0/gtk/gtkradiotoolbutton.h \
/usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h \
+ /usr/include/gtk-2.0/gtk/gtktoolbutton.h \
/usr/include/gtk-2.0/gtk/gtkscrolledwindow.h \
/usr/include/gtk-2.0/gtk/gtkviewport.h \
/usr/include/gtk-2.0/gtk/gtkseparatormenuitem.h \
/usr/include/gtk-2.0/gtk/gtktextmark.h \
/usr/include/gtk-2.0/gtk/gtktextview.h \
/usr/include/gtk-2.0/gtk/gtktipsquery.h \
+ /usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h \
/usr/include/gtk-2.0/gtk/gtktoolbar.h \
+ /usr/include/gtk-2.0/gtk/gtktoolbutton.h \
+ /usr/include/gtk-2.0/gtk/gtktoolitem.h \
/usr/include/gtk-2.0/gtk/gtktree.h \
/usr/include/gtk-2.0/gtk/gtktreednd.h \
/usr/include/gtk-2.0/gtk/gtktreeitem.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
- /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
- /usr/include/bits/string2.h ../../../../ltt/ltt.h \
+ /usr/include/alloca.h /usr/include/string.h ../../../../ltt/ltt.h \
../../../../ltt/time.h ../../../../ltt/compiler.h \
../../../../ltt/event.h ../../../../ltt/type.h ../../../../ltt/trace.h \
../../../../ltt/facility.h ../../../../lttv/lttv/module.h \
/usr/include/bits/mathcalls.h:
-/usr/include/bits/mathinline.h:
-
/usr/include/glib-2.0/glib.h:
/usr/include/glib-2.0/glib/galloca.h:
/usr/include/glib-2.0/glib/gmacros.h:
-/usr/lib/gcc-lib/i486-linux/3.3.5/include/stddef.h:
+/usr/lib/gcc/i486-linux-gnu/4.0.2/include/stddef.h:
-/usr/lib/gcc-lib/i486-linux/3.3.5/include/limits.h:
+/usr/lib/gcc/i486-linux-gnu/4.0.2/include/limits.h:
-/usr/lib/gcc-lib/i486-linux/3.3.5/include/syslimits.h:
+/usr/lib/gcc/i486-linux-gnu/4.0.2/include/syslimits.h:
/usr/include/limits.h:
/usr/include/bits/posix2_lim.h:
-/usr/lib/gcc-lib/i486-linux/3.3.5/include/float.h:
+/usr/lib/gcc/i486-linux-gnu/4.0.2/include/float.h:
/usr/include/glib-2.0/glib/garray.h:
/usr/include/glib-2.0/glib/gutils.h:
-/usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h:
+/usr/lib/gcc/i486-linux-gnu/4.0.2/include/stdarg.h:
/usr/include/glib-2.0/glib/gkeyfile.h:
+/usr/include/glib-2.0/glib/gmappedfile.h:
+
/usr/include/glib-2.0/glib/gmarkup.h:
/usr/include/glib-2.0/glib/gmessages.h:
/usr/include/bits/sys_errlist.h:
-/usr/include/bits/stdio.h:
-
/usr/include/glib-2.0/gmodule.h:
/usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h:
/usr/include/atk-1.0/atk/atkregistry.h:
+/usr/include/atk-1.0/atk/atkobjectfactory.h:
+
/usr/include/atk-1.0/atk/atkrelation.h:
/usr/include/atk-1.0/atk/atkrelationset.h:
/usr/include/gtk-2.0/gtk/gtkfilechooserdialog.h:
+/usr/include/gtk-2.0/gtk/gtkfilechooser.h:
+
/usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:
/usr/include/gtk-2.0/gtk/gtkfontbutton.h:
/usr/include/gtk-2.0/gtk/gtkmenutoolbutton.h:
+/usr/include/gtk-2.0/gtk/gtkmenu.h:
+
/usr/include/gtk-2.0/gtk/gtktoolbutton.h:
/usr/include/gtk-2.0/gtk/gtktoolitem.h:
/usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h:
+/usr/include/gtk-2.0/gtk/gtktoolbutton.h:
+
/usr/include/gtk-2.0/gtk/gtkscrolledwindow.h:
/usr/include/gtk-2.0/gtk/gtkviewport.h:
/usr/include/gtk-2.0/gtk/gtktipsquery.h:
+/usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h:
+
/usr/include/gtk-2.0/gtk/gtktoolbar.h:
+/usr/include/gtk-2.0/gtk/gtktoolbutton.h:
+
+/usr/include/gtk-2.0/gtk/gtktoolitem.h:
+
/usr/include/gtk-2.0/gtk/gtktree.h:
/usr/include/gtk-2.0/gtk/gtktreednd.h:
/usr/include/string.h:
-/usr/include/bits/string.h:
-
-/usr/include/bits/string2.h:
-
../../../../ltt/ltt.h:
../../../../ltt/time.h: