From 44f317b74c12963935e1893155eaada5dae31dd6 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 18 May 2006 18:11:49 +0000 Subject: [PATCH] fix core facility event update git-svn-id: http://ltt.polymtl.ca/svn@1829 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/tracefile.c | 106 +++++++++++++++--------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 3f52411d..9bd4e2c6 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -2002,71 +2002,71 @@ map_error: void ltt_update_event_size(LttTracefile *tf) { off_t size = 0; - - /* Specific handling of core events : necessary to read the facility control - * tracefile. */ LttFacility *f = ltt_trace_get_facility_by_num(tf->trace, tf->event.facility_id); - - if(likely(tf->event.facility_id == LTT_FACILITY_CORE)) { - switch((enum ltt_core_events)tf->event.event_id) { - case LTT_EVENT_FACILITY_LOAD: - size = strlen((char*)tf->event.data) + 1; - //g_debug("Update Event facility load of facility %s", (char*)tf->event.data); - size += ltt_align(size, sizeof(guint32), tf->has_alignment); - size += sizeof(struct LttFacilityLoad); - break; - case LTT_EVENT_FACILITY_UNLOAD: - //g_debug("Update Event facility unload"); - size = sizeof(struct LttFacilityUnload); - break; - case LTT_EVENT_STATE_DUMP_FACILITY_LOAD: - size = strlen((char*)tf->event.data) + 1; - size += ltt_align(size, sizeof(guint32), tf->has_alignment); - //g_debug("Update Event facility load state dump of facility %s", - // (char*)tf->event.data); - size += sizeof(struct LttStateDumpFacilityLoad); - break; - case LTT_EVENT_HEARTBEAT: - //g_debug("Update Event heartbeat"); - size = sizeof(TimeHeartbeat); - break; - default: - g_warning("Error in getting event size : tracefile %s, " - "unknown event id %hhu in core facility.", - g_quark_to_string(tf->name), - tf->event.event_id); - goto event_id_error; - - } - } else { - if(!f->exists) { + + if(!f->exists) { + /* Specific handling of core events : necessary to read the facility control + * tracefile. */ + + if(likely(tf->event.facility_id == LTT_FACILITY_CORE)) { + switch((enum ltt_core_events)tf->event.event_id) { + case LTT_EVENT_FACILITY_LOAD: + size = strlen((char*)tf->event.data) + 1; + //g_debug("Update Event facility load of facility %s", (char*)tf->event.data); + size += ltt_align(size, sizeof(guint32), tf->has_alignment); + size += sizeof(struct LttFacilityLoad); + break; + case LTT_EVENT_FACILITY_UNLOAD: + //g_debug("Update Event facility unload"); + size = sizeof(struct LttFacilityUnload); + break; + case LTT_EVENT_STATE_DUMP_FACILITY_LOAD: + size = strlen((char*)tf->event.data) + 1; + size += ltt_align(size, sizeof(guint32), tf->has_alignment); + //g_debug("Update Event facility load state dump of facility %s", + // (char*)tf->event.data); + size += sizeof(struct LttStateDumpFacilityLoad); + break; + case LTT_EVENT_HEARTBEAT: + //g_debug("Update Event heartbeat"); + size = sizeof(TimeHeartbeat); + break; + default: + g_warning("Error in getting event size : tracefile %s, " + "unknown event id %hhu in core facility.", + g_quark_to_string(tf->name), + tf->event.event_id); + goto event_id_error; + + } + } else { g_warning("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_warning("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; - } - - /* Compute the dynamic offsets */ - compute_offsets(tf, f, event_type, &size, tf->event.data); + LttEventType *event_type = + ltt_facility_eventtype_get(f, tf->event.event_id); - //g_debug("Event root field : f.e %hhu.%hhu size %zd", - // tf->event.facility_id, - // tf->event.event_id, size); + if(!event_type) { + g_warning("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; } + /* Compute the dynamic offsets */ + compute_offsets(tf, f, event_type, &size, tf->event.data); + + //g_debug("Event root field : f.e %hhu.%hhu size %zd", + // tf->event.facility_id, + // tf->event.event_id, size); + tf->event.data_size = size; /* Check consistency between kernel and LTTV structure sizes */ -- 2.34.1