add process names
[lttv.git] / ltt / branches / poly / lttv / lttv / tracecontext.c
index 1084ad60632acb75314a517a5647a6e37cf5edd5..6f1e7b58a334665c1f1254cb9204d67c3bbb9c23 100644 (file)
@@ -808,7 +808,10 @@ void lttv_process_traceset_end(LttvTracesetContext *self,
 
 /* Subtile modification : 
  * if tracefile has no event at or after the time requested, it is not put in
- * the queue, as the next read would fail. */
+ * the queue, as the next read would fail.
+ *
+ * Don't forget to empty the traceset pqueue before calling this.
+ */
 void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start)
 {
   guint i, nb_tracefile;
@@ -819,9 +822,6 @@ void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start)
 
   nb_tracefile = self->tracefiles->len;
 
-  g_tree_destroy(self->ts_context->pqueue);
-  self->ts_context->pqueue = g_tree_new(compare_tracefile);
-
   GTree *pqueue = self->ts_context->pqueue;
 
   for(i = 0 ; i < nb_tracefile ; i++) {
@@ -858,6 +858,9 @@ void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start)
 
   LttvTraceContext *tc;
 
+  g_tree_destroy(self->pqueue);
+  self->pqueue = g_tree_new(compare_tracefile);
+
   nb_trace = lttv_traceset_number(self->ts);
   for(i = 0 ; i < nb_trace ; i++) {
     tc = self->traces[i];
@@ -1004,7 +1007,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event,
     fac_id = g_array_index(facilities, guint, i);
     f = ltt_trace_get_facility_by_num(t, fac_id);
 
-    et = ltt_facility_eventtype_get_by_name(f, ltt_eventtype_name(et));
+    et = ltt_facility_eventtype_get_by_name(f, event);
     if(unlikely(et == NULL)) goto event_error;
     
     thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id);
@@ -1034,8 +1037,8 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event,
 type_error:
   goto free;
 event_error:
-  g_error("Event type %s does not exist", 
-      g_quark_to_string(ltt_eventtype_name(et)));
+  g_error("Event type does not exist for event %s", 
+      g_quark_to_string(event));
   goto free;
 facility_error:
   g_error("No %s facility", g_quark_to_string(facility));
@@ -1073,7 +1076,10 @@ void lttv_traceset_context_position_save(const LttvTracesetContext *self,
 {
   guint i;
   guint num_traces = lttv_traceset_number(self->ts);
-
+  
+  pos->tfc = g_array_set_size(pos->tfc, 0);
+  pos->ep = g_array_set_size(pos->ep, 0);
+  
   for(i=0; i<num_traces;i++) {
     GArray * tracefiles = self->traces[i]->tracefiles;
     guint j;
@@ -1122,8 +1128,8 @@ void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest,
   int i;
   LttEventPosition **src_ep, **dest_ep;
   
-  g_array_set_size(dest->ep, src->ep->len);
-  g_array_set_size(dest->tfc, src->tfc->len);
+  dest->ep = g_array_set_size(dest->ep, src->ep->len);
+  dest->tfc = g_array_set_size(dest->tfc, src->tfc->len);
   
   for(i=0;i<src->ep->len;i++) {
     src_ep = &g_array_index(src->ep, LttEventPosition*, i);
This page took 0.023242 seconds and 4 git commands to generate.