some fixes for global traces
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 19 Jun 2004 19:36:03 +0000 (19:36 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 19 Jun 2004 19:36:03 +0000 (19:36 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@601 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/attribute.c
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h
ltt/branches/poly/lttv/lttv/traceset.c

index 8088f3ba0901a53a7617853390a857d67ad23f10..a862cdf78ec094a9fe015b539d41c0221fdae09c 100644 (file)
@@ -506,6 +506,7 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data)
 
   klass->find_subdir = (LttvIAttribute* (*) (LttvIAttribute *self, 
       LttvAttributeName name)) lttv_attribute_find_subdir;
+
 }
 
 
index 1c2a7f4d4bb4ab950d655f7a00d80eb7febe7aa5..cb9bd70a79f65fbf4710e2220d5808784ee96eb8 100644 (file)
@@ -849,6 +849,12 @@ lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type,
 }
 
 
+LttvTracesetContextPosition *ltt_traceset_context_position_new()
+{
+  return g_new(LttvTracesetContextPosition,1);
+}
+
+
 void lttv_traceset_context_position_save(const LttvTracesetContext *self,
                                     LttvTracesetContextPosition *pos)
 {
@@ -907,6 +913,32 @@ void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos)
 
 }
 
+void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest,
+                                   const LttvTracesetContextPosition *src)
+{
+  guint nb_trace, nb_tracefile;
+  guint iter_trace, iter_tracefile;
+  
+  nb_trace = dest->nb_trace = src->nb_trace;
+  dest->t_pos = g_new(LttvTraceContextPosition, nb_trace);
+  for(iter_trace = 0 ; iter_trace < nb_trace ; iter_trace++) {
+
+    nb_tracefile = dest->t_pos[iter_trace].nb_tracefile =
+                    src->t_pos[iter_trace].nb_tracefile;
+
+    for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) {
+      dest->t_pos[iter_trace].tf_pos[iter_tracefile] = 
+                      ltt_event_position_new();
+      ltt_event_position_copy(
+              dest->t_pos[iter_trace].tf_pos[iter_tracefile],
+              src->t_pos[iter_trace].tf_pos[iter_tracefile]);
+    }
+  }
+
+  dest->timestamp = src->timestamp;
+}
+
 gint lttv_traceset_context_ctx_pos_compare(const LttvTracesetContext *self,
                                         const LttvTracesetContextPosition *pos)
 {
index 77f9f63cdbf28402e0d8b62f143c9f20ae3bf6aa..3a3f5f61fab13ff4cfe743affdfea7c52cf96cd6 100644 (file)
@@ -282,11 +282,16 @@ void lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type,
 LttvTracefileContext *lttv_traceset_context_get_current_tfc(
                              LttvTracesetContext *self);
 
+LttvTracesetContextPosition *ltt_traceset_context_position_new();
+
 void lttv_traceset_context_position_save(const LttvTracesetContext *self,
                                     LttvTracesetContextPosition *pos);
 
 void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos);
 
+void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest,
+                                   const LttvTracesetContextPosition *src);
+
 gint lttv_traceset_context_pos_pos_compare(
                               const LttvTracesetContextPosition *pos1,
                               const LttvTracesetContextPosition *pos2);
index c487b64e632967bb96548119fcf79fe60c692b57..fd67c68859b834ca4daeee12fb64317456579689 100644 (file)
@@ -83,11 +83,8 @@ LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig)
     trace = g_ptr_array_index(s_orig->traces, i);
     trace->ref_count++;
 
-    /*CHECK this used ltt_trace_copy while it may not be needed. Need to
-      define how traces and tracesets are shared */
-    g_ptr_array_add(
-        s->traces,
-       g_ptr_array_index(s_orig->traces, i));
+    g_ptr_array_add(s->traces,
+                         trace);
   }
   s->a = LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig->a)));
   return s;
@@ -122,6 +119,14 @@ gint lttv_traceset_save(LttvTraceset *s)
 
 void lttv_traceset_destroy(LttvTraceset *s) 
 {
+  guint i;
+
+  for(i=0;i<s->traces->len;i++) {
+    LttvTrace *trace = g_ptr_array_index(s->traces, i);
+    lttv_trace_unref(trace);
+    if(lttv_trace_get_ref_number(trace) == 0)
+      lttv_trace_destroy(trace);
+  }
   g_ptr_array_free(s->traces, TRUE);
   g_object_unref(s->a);
   g_free(s);
This page took 0.028365 seconds and 4 git commands to generate.