if(likely(tf->event.facility_id == LTT_FACILITY_CORE)) {
switch((enum ltt_core_events)tf->event.event_id) {
case LTT_EVENT_FACILITY_LOAD:
- size = sizeof(struct LttFacilityLoad);
+ size = strlen((char*)tf->event.data);
+ size += sizeof(struct LttFacilityLoad);
break;
case LTT_EVENT_FACILITY_UNLOAD:
size = sizeof(struct LttFacilityUnload);
break;
case LTT_EVENT_STATE_DUMP_FACILITY_LOAD:
- size = sizeof(struct LttStateDumpFacilityLoad);
+ size = strlen((char*)tf->event.data);
+ size += sizeof(struct LttStateDumpFacilityLoad);
break;
case LTT_EVENT_HEARTBEAT:
size = sizeof(TimeHeartbeat);
}
} else {
+ if(!f->exists) {
+ g_error("Unknown facility %hhu (0x%hhx) in tracefile %s",
+ tf->event.facility_id,
+ tf->event.facility_id,
+ g_quark_to_string(tf->name));
+ goto facility_error;
+ }
+
LttEventType *event_type =
ltt_facility_eventtype_get(f, tf->event.event_id);
+
+ if(!event_type) {
+ g_error("Unknown event id %hhu in facility %s in tracefile %s",
+ tf->event.event_id,
+ g_quark_to_string(f->name),
+ g_quark_to_string(tf->name));
+ goto event_type_error;
+ }
+
size = get_field_type_size(tf, event_type,
0, 0, event_type->root_field, tf->event.data);
+ g_debug("Event root field : f.e %hhu.%hhu size %lu", tf->event.facility_id,
+ tf->event.event_id, size);
}
tf->event.data_size = size;
return;
+facility_error:
+event_type_error:
event_id_error:
tf->event.data_size = 0;
}